예제 #1
0
<?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>&nbsp;</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>&nbsp;</p><p>&nbsp;</p>";
}
JB_template_candidates_footer();
예제 #2
0
    function process_payment_return()
    {
        global $label;
        if ($_REQUEST['order_id'] != '' && $_REQUEST['nhezk5'] != '') {
            $invoice_id = jb_strip_order_id($_REQUEST['order_id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($_SESSION['JB_ID'] == '') {
                echo "Error: You must be logged in to view this page";
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
            } else {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
                ?>
				
				<div style='background-color: #ffffff; border-color:#C0C0C0; border-style:solid;padding:10px'>
				<p align="center"><center>
				<?php 
                if ($product_type == 'P') {
                    $sql = "SELECT * from package_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'S') {
                    $sql = "SELECT * from subscription_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'M') {
                    $sql = "SELECT * from membership_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
                $order_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if (BANK_TAX_RATE > 0) {
                    if (BANK_ADD_TAX != 'Y') {
                        // taxes included in prices
                        // work out the tax paid in the amount
                        $tax = $order_row['amount'] - $order_row['amount'] / (1.0 + BANK_TAX_RATE);
                    } else {
                        $tax = $order_row['amount'] * BANK_TAX_RATE;
                        $order_row['amount'] = $order_row['amount'] + $tax;
                        // update the amount on the invoice row
                        if (!does_field_exist("package_invoices", "invoice_tax")) {
                            $sql = "ALTER TABLE `package_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                            $sql = "ALTER TABLE `subscription_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                            $sql = "ALTER TABLE `membership_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                        }
                        if ($product_type == 'P') {
                            $sql = "UPDATE package_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != '' ";
                        } elseif ($product_type == 'S') {
                            $sql = "UPDATE subscription_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != ''";
                        } elseif ($product_type == 'M') {
                            $sql = "UPDATE membership_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != ''";
                        }
                    }
                }
                if (BANK_ADVANCE_CREDIT == 'YES' && strtolower($order_row['status']) != 'pending') {
                    // place the order as 'pending' and advance the credits
                    if ($product_type == 'P') {
                        // posting credits
                        $order_row = JB_pend_package_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        // credit the points to the customer's account
                        JB_add_posting_credits($order_row);
                    }
                    if ($product_type == 'S') {
                        // subscription to view resumes
                        $order_row = JB_pend_subscription_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        JB_start_employer_subscription($order_row);
                    }
                    if ($product_type == 'M') {
                        // membership
                        $order_row = JB_pend_membership_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        JB_start_membership($order_row);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                }
                $bank_amount = JB_convert_to_currency($order_row['amount'], $order_row['currency_code'], BANK_CURRENCY);
                $bank_amount = JB_format_currency($bank_amount, BANK_CURRENCY, true);
                $label['payment_bank_heading'] = str_replace("%INVOICE_AMOUNT%", $bank_amount, $label['payment_bank_heading']);
                $label['payment_bank_note'] = str_replace("%CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $label['payment_bank_note']);
                $label['payment_bank_note'] = str_replace("%INVOICE_CODE%", $product_type . $invoice_id, $label['payment_bank_note']);
                $label['payment_bank_tax'] = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $label['payment_bank_tax']);
                if (JB_get_default_currency() != BANK_CURRENCY) {
                    echo JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']) . " = " . $bank_amount;
                    echo "<br>";
                }
                ?>
				
				<table width="70%"><tr><td>
				<?php 
                if (BANK_TAX_RATE > 0) {
                    ?>
				<b><?php 
                    echo $label['payment_bank_tax'];
                    ?>
</b><br>
				<?php 
                }
                ?>
				<b><?php 
                echo $label['payment_bank_heading'];
                ?>
</b><br>
				
				<?php 
                if (BANK_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_name'];
                    ?>
</b> <?php 
                    echo BANK_NAME;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ADDRESS != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_addr'];
                    ?>
</b> <?php 
                    echo BANK_ADDRESS;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ACCOUNT_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_ac_name'];
                    ?>
</b> <?php 
                    echo BANK_ACCOUNT_NAME;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ACCOUNT_NUMBER != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_ac_number'];
                    ?>
</b> <?php 
                    echo BANK_ACCOUNT_NUMBER;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_BRANCH_NUMBER != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_branch_number'];
                    ?>
</b> <?php 
                    echo BANK_BRANCH_NUMBER;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_SWIFT != '') {
                    ?>

				<b><?php 
                    echo $label['payment_bank_swift'];
                    ?>
</b> <?php 
                    echo BANK_SWIFT;
                    ?>
<br>

				<?php 
                }
                ?>
				<?php 
                echo $label['payment_bank_note'];
                ?>
				</td></tr>
				</table>
				
				</p>
				</center>
				
				</div>
				<?php 
                if ($order_row['user_type'] == 'C') {
                    $sql = "Select * from users where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } else {
                    $sql = "Select * from employers where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error());
                $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if ($product_type == 'P') {
                    $template_r = JB_get_email_template(60, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "P" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 60);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'S') {
                    // subscription invoice confirmed (id 80)
                    $template_r = JB_get_email_template(80, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SUB_DURATION%", $order_row['months_duration'], $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 80);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'M') {
                    // membership invoice confirmed (id 100)
                    $template_r = JB_get_email_template(100, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "M" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%INVOICE_CODE%", "M" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    if ($order_row['months_duration'] == '0') {
                        $order_row['months_duration'] = $label['member_not_expire'];
                    }
                    $msg = str_replace("%MEM_DURATION%", $order_row['months_duration'], $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 100);
                        JB_process_mail_queue(1, $email_id);
                    }
                }
                JB_update_payment_method($product_type, $order_row['invoice_id'], "bank");
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }
예제 #3
0
    function process_payment_return()
    {
        global $label;
        if ($_REQUEST['order_id'] != '' && $_REQUEST['nhezk5'] != '') {
            $invoice_id = jb_strip_order_id($_REQUEST['order_id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($_SESSION['JB_ID'] == '') {
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
                echo "Error: You must be logged in to view this page";
            } else {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
                ?>
		

			<div style='background-color: #ffffff; border-color:#C0C0C0; border-style:solid;padding:10px'>
		<p align="center"><center>
				<?php 
                if ($product_type == 'P') {
                    $sql = "SELECT * from package_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'S') {
                    $sql = "SELECT * from subscription_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'M') {
                    $sql = "SELECT * from membership_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
                $order_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if (CHECK_TAX_RATE > 0) {
                    if (CHECK_ADD_TAX != 'Y') {
                        // work out the tax paid in the amount
                        $tax = $order_row['amount'] - $order_row['amount'] / (1.0 + CHECK_TAX_RATE);
                    } else {
                        $tax = $order_row['amount'] * CHECK_TAX_RATE;
                        $order_row['amount'] = $order_row['amount'] + $tax;
                    }
                }
                if (CHECK_ADVANCE_CREDIT == 'YES' && strtolower($order_row['status']) != 'pending') {
                    // place the order as 'pending' and advance the credits
                    if ($product_type == 'P') {
                        // posting credits
                        $order_row = JB_pend_package_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        // credit the points to the customer's account
                        JB_add_posting_credits($order_row);
                    }
                    if ($product_type == 'S') {
                        // subscription to view resumes
                        $order_row = JB_pend_subscription_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        JB_start_employer_subscription($order_row);
                    }
                    if ($product_type == 'M') {
                        // membership
                        $order_row = JB_pend_membership_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        JB_start_membership($order_row);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                }
                $check_amount = JB_convert_to_currency($order_row['amount'], $order_row['currency_code'], CHECK_CURRENCY);
                $check_amount = JB_format_currency($check_amount, CHECK_CURRENCY, true);
                $label['payment_check_sub_head'] = str_replace("%INVOICE_CODE%", $product_type . $_REQUEST['order_id'], $label['payment_check_sub_head']);
                echo $label['payment_check_sub_head'];
                $label['payment_check_heading'] = str_replace("%INVOICE_AMOUNT%", $check_amount, $label['payment_check_heading']);
                $label['payment_check_tax'] = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $label['payment_check_tax']);
                if (JB_get_default_currency() != CHECK_CURRENCY) {
                    echo JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']) . " = " . $check_amount;
                    echo "<br>";
                }
                ?>
				
				<table width="70%"><tr><td>
				<?php 
                if (CHECK_TAX_RATE > 0) {
                    ?>
				<b><?php 
                    echo $label['payment_check_tax'];
                    ?>
</b><br>
				<?php 
                }
                ?>
				<b><?php 
                echo $label['payment_check_heading'];
                ?>
</b><br>
				<?php 
                if (CHECK_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_check_payable'];
                    ?>
</b><pre><?php 
                    echo CHECK_PAYABLE;
                    ?>
</pre><br>
				<?php 
                }
                ?>
				<?php 
                if (CHECK_ADDRESS != '') {
                    ?>
				<b><?php 
                    echo $label['payment_check_address'];
                    ?>
</b><pre><?php 
                    echo CHECK_ADDRESS;
                    ?>
</pre><br>
				<?php 
                }
                ?>
				<?php 
                /*if ( CHECK_ACCOUNT_NAME != '') { ?>
                		<b><?php echo $label['payment_check_currency'];?></b><pre><?php echo CHECK_CURRENCY; ?></pre><br>
                		<?php } */
                ?>
				
				</td></tr>
				</table>
				
				</p>
				</center>
				
				</div>
				<?php 
                if ($order_row['user_type'] == 'C') {
                    $sql = "Select * from users where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } else {
                    $sql = "Select * from employers where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error());
                $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if ($product_type == 'S') {
                    $template_r = JB_get_email_template(81, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%SUB_DURATION%", $order_row['months_duration'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 81);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'M') {
                    $template_r = JB_get_email_template(101, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    if ($order_row['months_duration'] == '0') {
                        $order_row['months_duration'] = $label['member_not_expire'];
                    }
                    $msg = str_replace("%MEM_DURATION%", $order_row['months_duration'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 101);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'P') {
                    $template_r = JB_get_email_template(61, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "P" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 61);
                        JB_process_mail_queue(1, $email_id);
                    }
                }
                JB_update_payment_method($product_type, $order_row['invoice_id'], "check");
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }