Exemple #1
0
/**
 * Gets a minify url with all the scripts in the queue
 * @return string Url
 */
function minify_scripts()
{
    $scripts = minify_filter_external_js();
    osc_register_script('minify_scripts', osc_route_url('minify_scripts', array('minify_files' => implode(',', minify_clean_url($scripts)))));
    osc_enqueue_script('minify_scripts');
    return;
}
 private function processData($products)
 {
     if (!empty($products)) {
         $total = 0;
         foreach ($products as $aRow) {
             $row = array();
             $row['id'] = $aRow['id'];
             $row['description'] = $aRow['description'];
             $row['amount'] = osc_format_price(1000000 * $aRow['amount'], osc_get_preference('currency', 'payment_pro'));
             $row['quantity'] = $aRow['quantity'];
             $row['total'] = osc_format_price(1000000 * $aRow['amount'] * $aRow['quantity'], osc_get_preference('currency', 'payment_pro'));
             $row['delete'] = '<a href="' . osc_route_url('payment-pro-cart-delete', array('id' => $aRow['id'])) . '" >' . __('Delete', 'payment_pro') . '</a>';
             $row = osc_apply_filter('payment_pro_processing_row', $row, $aRow);
             $this->addRow($row);
             $this->rawRows[] = $aRow;
             $total += $aRow['amount'] * $aRow['quantity'];
         }
         $row = array();
         $row['id'] = '';
         $row['description'] = '';
         $row['amount'] = '';
         $row['quantity'] = '<b>' . __('Total', 'payment_pro') . '</b>';
         $row['total'] = '<b>' . osc_format_price(1000000 * $total, osc_get_preference('currency', 'payment_pro')) . '</b>';
         $row['delete'] = '';
         $this->addRow($row);
         //$this->rawRows[] = $row;
     }
 }
    public static function button($products, $extra = null)
    {
        $Amount = 0;
        foreach ($products as $p) {
            $Amount += $p['amount'] * $p['quantity'];
        }
        $r = rand(0, 1000);
        $extra['random'] = $r;
        $extra['items'] = $products;
        $extra['amount'] = $Amount;
        $extra = payment_pro_set_custom($extra);
        $tx_id = ModelPaymentPro::newInstance()->pendingInvoice($products);
        $Merchant_Id = osc_get_preference('ccavenue_merchant_id', 'payment_pro');
        $Order_Id = $tx_id;
        // use order id/invoice id instead of product_id
        $WorkingKey = osc_get_preference('ccavenue_working_key', 'payment_pro');
        $Redirect_Url = osc_route_url('ccavenue-redirect');
        $Checksum = self::_getCheckSum($Merchant_Id, $Amount, $Order_Id, $Redirect_Url, $WorkingKey);
        ?>
            <li class="payment ccavenue-btn">
                <form id="ccavenue_<?php 
        echo $r;
        ?>
" name="paymentform" method="post" action="https://www.ccavenue.com/shopzone/cc_details.jsp">
                    <input type="hidden" name="Merchant_Id" value="<?php 
        echo $Merchant_Id;
        ?>
">
                    <input type="hidden" name="Amount" value="<?php 
        echo $Amount;
        ?>
">
                    <input type="hidden" name="Order_Id" value="<?php 
        echo $Order_Id;
        ?>
">
                    <input type="hidden" name="Redirect_Url" value="<?php 
        echo $Redirect_Url;
        ?>
">
                    <input type="hidden" name="Checksum" value="<?php 
        echo $Checksum;
        ?>
">
                    <input type="hidden" name="Merchant_Param" value="<?php 
        echo $extra;
        ?>
">
                </form>
                <a id="button-confirm" class="button" onclick="$('#ccavenue_<?php 
        echo $r;
        ?>
').submit();"><span><img  style="cursor:pointer;cursor:hand" src='<?php 
        echo PAYMENT_PRO_URL;
        ?>
payments/ccavenue/ccavenue.gif' border='0' /></span></a>
            </li>
            <?php 
    }
 public static function createOrder()
 {
     if (osc_get_preference('coinjar_sandbox', 'payment') != 1) {
         $coinjar = new CoinJar(payment_decrypt(osc_get_preference('coinjar_merchant_user', 'payment')), payment_decrypt(osc_get_preference('coinjar_merchant_password', 'payment')), payment_decrypt(osc_get_preference('coinjar_api_key', 'payment')));
     } else {
         $coinjar = new CoinJar(payment_decrypt(osc_get_preference('coinjar_sb_merchant_user', 'payment')), payment_decrypt(osc_get_preference('coinjar_sb_merchant_password', 'payment')), payment_decrypt(osc_get_preference('coinjar_sb_api_key', 'payment')), true);
     }
     $items[0]['name'] = Params::getParam('description');
     $items[0]['quantity'] = 1;
     $items[0]['amount'] = payment_get_amount(Params::getParam('itemnumber'));
     $order_json = $coinjar->createOrder($items, osc_get_preference('currency', 'payment'), Params::getParam('itemnumber'), osc_get_preference('coinjar_merchant_reference', 'payment'), osc_route_url('coinjar-notify', array('extra' => Params::getParam('extra'))), osc_route_url('coinjar-return', array('extra' => Params::getParam('extra'))), osc_route_url('coinjar-cancel', array('extra' => Params::getParam('extra'))));
     $order = json_decode($order_json);
     if (isset($order->order->uuid)) {
         echo json_encode(array('url' => $coinjar->orderPage($order->order->uuid), 'error' => 0));
     } else {
         echo json_encode(array('error' => 1, 'status' => @$order->order->status, 'msg' => @$order->order->error));
     }
 }
                //Redirect to thank you page
            } else {
                osc_add_flash_ok_message(_m('Changes have been applied'));
                osc_redirect_to(osc_route_url('payment-publish', array('itemId' => $iItemId)));
            }
        } elseif (isset($result_array->name)) {
            osc_add_flash_ok_message(_m($result_array->name));
            osc_redirect_to(osc_route_url('payment-publish', array('itemId' => $iItemId)));
        }
    }
}
if (isset($_POST['paypal-payment'])) {
    $item_title = Params::getParam('item_title');
    $premium_cost = Params::getParam('premium_cost');
    $paypal_api_server = osc_get_preference('paypal_server_classic', 'classified');
    $paypal_server = osc_get_preference('paypal_server', 'classified');
    $username = osc_get_preference('paypal_username', 'classified');
    $password = osc_get_preference('paypal_password', 'classified');
    $signature = osc_get_preference('paypal_signature', 'classified');
    $currency = osc_get_preference('default_currency', 'classified');
    $id = Params::getParam('itemId');
    $post_data = array('USER' => $username, 'PWD' => $password, 'SIGNATURE' => $signature, 'VERSION' => '93', 'PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE', 'PAYMENTREQUEST_0_AMT' => $premium_cost, 'PAYMENTREQUEST_0_ITEMAMT' => $premium_cost, 'PAYMENTREQUEST_0_CURRENCYCODE' => $currency, 'PAYMENTREQUEST_0_DESC' => 'Premium payment for ' . $item_title, 'METHOD' => 'SetExpressCheckout', 'RETURNURL' => osc_route_url('payment-return', array('itemId' => $id)), 'CANCELURL' => osc_route_url('payment-cancel', array('itemId' => $id)), 'L_PAYMENTREQUEST_0_AMT0' => $premium_cost, 'L_PAYMENTREQUEST_0_QTY0' => 1, 'L_PAYMENTREQUEST_0_NAME0' => 'Premium payment for ' . $item_title);
    $response = execute_paypal_nvp_post($post_data, $paypal_api_server);
    if ($response['ACK'] == 'Success') {
        $token = $response['TOKEN'];
        header('Location:' . $paypal_server . 'cgi-bin/webscr?cmd=_express-checkout&token=' . $token);
    } elseif ($response['ACK'] == 'Failure') {
        osc_add_flash_error_message(_m($response['L_LONGMESSAGE0']));
        osc_redirect_to(osc_route_url('payment-publish', array('itemId' => $id)));
    }
}
<?php

$status = CcavenuePayment::processPayment();
// GET TX ID
$tx = Params::getParam('Order_Id');
if ($status == PAYMENT_PRO_COMPLETED) {
    osc_add_flash_ok_message(__('Payment processed correctly', 'payment_pro'));
} else {
    if ($status == PAYMENT_PRO_PENDING) {
        osc_add_flash_info_message(__('We are processing your payment, if we did not finish in a few seconds, please contact us', 'payment_pro'));
    } else {
        osc_add_flash_error_message(sprintf(__('Something failed! Please write down this transaction ID and contact us: %s', 'payment_pro'), $tx));
    }
}
payment_pro_js_redirect_to(osc_route_url('payment-pro-done', array('tx' => $tx)));
Exemple #7
0
                         </div>   
                         <div class="col-lg-6 col-md-6">
                            <div class="row">                             
                                <!--<a href="#seller-profile" role="button" data-toggle="modal" data-target="#seller-profile">Seller Profile</a>-->
                              <img src="<?php 
echo nc_osc_get_public_picture_link(osc_item_user_id());
?>
" class="img-responsive">
                            </div>
                            <div class="row">
                                <?php 
if (osc_logged_user_id() != osc_item_user_id()) {
    ?>
                                
                                    <!--<a href="<?php 
    echo osc_route_url('seller-items', array('seller' => osc_item_user_id()));
    ?>
" >-->
                                    <a href="<?php 
    echo osc_search_url(array('seller_post' => osc_item_user_id()));
    ?>
">See other items from seller</a>
                                <?php 
}
?>
                            </div>  
                            <div class="row">
                                <?php 
if (osc_is_web_user_logged_in()) {
    ?>
                                    <?php 
Exemple #8
0
/**
 * Create a new menu option on users' dashboards
 */
function payment_user_menu()
{
    echo '<li class="opt_payment" ><a href="' . osc_route_url('payment-user-menu') . '" >' . __("Listings payment status", "payment") . '</a></li>';
    if (osc_get_preference('pack_price_1', 'payment') != '' && osc_get_preference('pack_price_1', 'payment') != '0' || osc_get_preference('pack_price_2', 'payment') != '' && osc_get_preference('pack_price_2', 'payment') != '0' || osc_get_preference('pack_price_3', 'payment') != '' && osc_get_preference('pack_price_3', 'payment') != '0') {
        echo '<li class="opt_payment_pack" ><a href="' . osc_route_url('payment-user-pack') . '" >' . __("Buy credit for payments", "payment") . '</a></li>';
    }
}
function payment_pro_show_item($item)
{
    if (osc_get_preference("pay_per_post", 'payment_pro') == "1" && !ModelPaymentPro::newInstance()->publishFeeIsPaid($item['pk_i_id'])) {
        if (osc_is_admin_user_logged_in()) {
            osc_get_flash_message('pubMessages', true);
            osc_add_flash_warning_message(__('The listing hasn\'t been paid', 'payment_pro'));
        } else {
            if (osc_is_web_user_logged_in() && osc_logged_user_id() == $item['fk_i_user_id']) {
                osc_get_flash_message('pubMessages', true);
                osc_add_flash_warning_message(sprintf(__('To make this listing available to others, you need to pay a publish fee. <a href="%s">Continue and make the ad public</a>', 'payment_pro'), osc_route_url('payment-pro-user-menu')));
            } else {
                ob_get_clean();
                Rewrite::newInstance()->set_location('error');
                header('HTTP/1.1 400 Bad Request');
                osc_current_web_theme_path('404.php');
                exit;
            }
        }
    }
}
                }
            });
        }
        function addPublish(id) {
            $("#pub_" + id).attr('disabled', true);
            $.ajax({
                type: "POST",
                url: '<?php 
    echo osc_ajax_plugin_url(PAYMENT_PRO_PLUGIN_FOLDER . 'ajax.php');
    ?>
&pub=' + id,
                dataType: 'json',
                success: function(data){
                    if(data.error==0) {
                        window.location = '<?php 
    echo osc_route_url('payment-pro-checkout');
    ?>
';
                    } else {
                        $("#pub_" + id).attr('disabled', false);
                        var flash = $("#flash_js");
                        var message = $('<div>').addClass('flashmessage').addClass('flashmessage-error').attr('id', 'flashmessage').html(data.msg);
                        flash.html(message);
                        $("#flashmessage").slideDown('slow').delay(3000).slideUp('slow');
                        $("html, body").animate({ scrollTop: 0 }, "slow");
                    }
                }
            });
        }
    </script>
<?php 
    public static function recurringButton($subscription, $extra = null)
    {
        $r = rand(0, 1000);
        $extra['random'] = $r;
        $extra = payment_pro_set_custom($extra);
        if (osc_get_preference('paypal_sandbox', 'payment_pro') == 1) {
            $ENDPOINT = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
        } else {
            $ENDPOINT = 'https://www.paypal.com/cgi-bin/webscr';
        }
        ?>


            <form class="nocsrf" action="<?php 
        echo $ENDPOINT;
        ?>
" method="post" id="paypal_<?php 
        echo $r;
        ?>
">
                <input type="hidden" name="cmd" value="_xclick-subscriptions" />
                <input type="hidden" name="notify_url" value="<?php 
        echo osc_route_url('paypal-notify', array('extra' => $extra));
        ?>
" />
                <input type="hidden" name="return" value="<?php 
        echo osc_route_url('paypal-return', array('extra' => $extra));
        ?>
" />
                <input type="hidden" name="cancel_return" value="<?php 
        echo osc_route_url('paypal-cancel', array('extra' => $extra));
        ?>
" />
                <input type="hidden" name="business" value="<?php 
        echo osc_get_preference('paypal_email', 'payment_pro');
        ?>
" />

                <input type="hidden" name="item_name" value="<?php 
        echo $subscription['description'];
        ?>
" />
                <input type="hidden" name="a3" value="<?php 
        echo $subscription['amount'];
        ?>
" />
                <input type="hidden" name="p3" value="<?php 
        echo $subscription['duration'];
        ?>
" />
                <input type="hidden" name="t3" value="<?php 
        echo $subscription['period'];
        ?>
" />

                <input type="hidden" name="src" value="1" />

                <input type="hidden" name="currency_code" value="<?php 
        echo osc_get_preference('currency', 'payment_pro');
        ?>
" />
                <input type="hidden" name="custom" value="<?php 
        echo $extra;
        ?>
" />
                <input type="hidden" name="no_note" value="1" />
                <input type="hidden" name="charset" value="utf-8" />
            </form>
            <div class="buttons">
                <div class="right"><a style="cursor:pointer;cursor:hand" id="button-confirm" class="button" onclick="$('#paypal_<?php 
        echo $r;
        ?>
').submit();"><span><img src='<?php 
        echo PAYMENT_PRO_URL;
        ?>
payments/paypal/subscription.gif' border='0' /></span></a></div>
            </div>
        <?php 
    }
 public static function ajaxPayment()
 {
     $status = AuthorizePayment::processPayment();
     if ($status == PAYMENT_PRO_COMPLETED) {
         payment_pro_cart_drop();
         osc_add_flash_ok_message(sprintf(__('Success! Please write down this transaction ID in case you have any problem: %s', 'payment_pro'), Params::getParam('braintree_transaction_id')));
         payment_pro_js_redirect_to(osc_route_url('payment-pro-done', array('tx' => Params::getParam('braintree_transaction_id'))));
     } else {
         if ($status == PAYMENT_PRO_ALREADY_PAID) {
             payment_pro_cart_drop();
             osc_add_flash_warning_message(__('Warning! This payment was already paid', 'payment_pro'));
             payment_pro_js_redirect_to(osc_route_url('payment-pro-done', array('tx' => Params::getParam('authorize_transaction_id'))));
         } else {
             printf(__('There were an error processing your payment: %s', 'payment_pro'), Params::getParam('authorize_error'));
         }
     }
 }
Exemple #13
0
function item_success_redirect($item)
{
    if (!OC_ADMIN) {
        if (isset($item['pk_i_id'])) {
            Session::newInstance()->_dropKeepForm();
            if ($item['b_active'] == 0) {
                osc_add_flash_ok_message(_m('Check your inbox to validate your listing'));
            } else {
                // only if enabled and active can show item-success page
                if ($item['b_active'] == 1 && $item['b_enabled'] == 1) {
                    // item-success redirect
                    Session::newInstance()->_set('inserted_item', $item);
                    osc_redirect_to(osc_route_url('item-success'));
                    exit;
                }
            }
            $itemId = Params::getParam('itemId');
            $category = Category::newInstance()->findByPrimaryKey(Params::getParam('catId'));
            View::newInstance()->_exportVariableToView('category', $category);
            osc_redirect_to(osc_search_category_url());
        }
    }
}
Exemple #14
0
                <?php 
}
?>
                <?php 
if (!osc_logged_user_id() == osc_item_user_id()) {
    ?>
                        <a href="<?php 
    echo osc_route_url('seller-items', array('seller' => osc_item_user_id()));
    ?>
" >See other items from seller</a>
                        
                <?php 
}
?>
                <a href="<?php 
echo osc_route_url('watchlist');
?>
" >Check my Watchlist</a>
                <?php 
if (osc_comments_enabled()) {
    ?>
                <?php 
    if (osc_reg_user_post_comments() && osc_is_web_user_logged_in() || !osc_reg_user_post_comments()) {
        ?>
                <?php 
        if (nc_osc_show_fb_comment()) {
            ?>
                        
                        <div class="fb-comments" 
                             data-href="<?php 
            echo getUrl();
Exemple #15
0
/**
 * Send email to un-registered users with payment options
 *
 * @param integer $item
 * @param float $category_fee
 */
function payment_send_email($item, $category_fee)
{
    if (osc_is_web_user_logged_in()) {
        return false;
    }
    $mPages = new Page();
    $aPage = $mPages->findByInternalName('email_payment');
    $locale = osc_current_user_locale();
    $content = array();
    if (isset($aPage['locale'][$locale]['s_title'])) {
        $content = $aPage['locale'][$locale];
    } else {
        $content = current($aPage['locale']);
    }
    $item_url = osc_item_url();
    $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
    $publish_url = osc_route_url('payment-publish', array('itemId' => $item['pk_i_id']));
    $premium_url = osc_route_url('payment-premium', array('itemId' => $item['pk_i_id']));
    $words = array();
    $words[] = array('{ITEM_ID}', '{CONTACT_NAME}', '{CONTACT_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{PUBLISH_LINK}', '{PUBLISH_URL}', '{PREMIUM_LINK}', '{PREMIUM_URL}', '{START_PUBLISH_FEE}', '{END_PUBLISH_FEE}', '{START_PREMIUM_FEE}', '{END_PREMIUM_FEE}');
    $words[] = array($item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], osc_base_url(), $item['s_title'], $item_url, osc_page_title(), '<a href="' . $publish_url . '">' . $publish_url . '</a>', $publish_url, '<a href="' . $premium_url . '">' . $premium_url . '</a>', $premium_url, '', '', '', '');
    if ($category_fee == 0) {
        $content['s_text'] = preg_replace('|{START_PUBLISH_FEE}(.*){END_PUBLISH_FEE}|', '', $content['s_text']);
    }
    $premium_fee = ModelPayment::newInstance()->getPremiumPrice($item['fk_i_category_id']);
    if ($premium_fee == 0) {
        $content['s_text'] = preg_replace('|{START_PREMIUM_FEE}(.*){END_PREMIUM_FEE}|', '', $content['s_text']);
    }
    $title = osc_mailBeauty($content['s_title'], $words);
    $body = osc_mailBeauty($content['s_text'], $words);
    $emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
    osc_sendMail($emailParams);
}
    }
    echo osc_item_city();
    ?>
 (<?php 
    echo osc_item_region();
    ?>
) - <?php 
    echo osc_format_date(osc_item_pub_date());
    ?>
</strong></p>
                            <p><?php 
    echo osc_highlight(strip_tags(osc_item_description()));
    ?>
</p>
                            <form name="add-to-watchlist" method="post" action="<?php 
    echo osc_route_url('nc-functions');
    ?>
">
                                <input type="hidden" name="nc_action" value="REMOVE-WATCHLIST"/>
                                <input type="hidden" name="item_id" value="<?php 
    echo osc_item_id();
    ?>
" />
                                <input type="hidden" name="return_url" id="return_url" value="<?php 
    echo $current_url;
    ?>
">
                                <Button class="btn btn-primary">Remove from Watch List</Button>
                            </form>
                        </td>
                </tr>
<?php

$id = Params::getParam('id');
payment_pro_cart_drop($id);
// IF removed publish fee, remove too the premium fee so a user is not able to pay just the premium but not the publish fee
if (substr($id, 0, 3) == 'PUB') {
    payment_pro_cart_drop('PRM' . substr($id, 3));
}
payment_pro_js_redirect_to(osc_route_url('payment-pro-checkout'));
function payment_pro_send_email($email)
{
    $item = Item::newInstance()->findByPrimaryKey($email['fk_i_item_id']);
    $mPages = new Page();
    $aPage = $mPages->findByInternalName('payment_pro_email_payment');
    $locale = osc_current_user_locale();
    $content = array();
    if (isset($aPage['locale'][$locale]['s_title'])) {
        $content = $aPage['locale'][$locale];
    } else {
        $content = current($aPage['locale']);
    }
    $item_url = osc_item_url();
    $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
    $publish_url = osc_route_url('payment-pro-addcart', array('item' => 'PUB' . $item['fk_i_category_id'] . '-' . $item['pk_i_id']));
    $premium_url = osc_route_url('payment-pro-addcart', array('item' => 'PRM' . $item['fk_i_category_id'] . '-' . $item['pk_i_id']));
    $words = array();
    $words[] = array('{ITEM_ID}', '{CONTACT_NAME}', '{CONTACT_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{PUBLISH_LINK}', '{PUBLISH_URL}', '{PREMIUM_LINK}', '{PREMIUM_URL}', '{START_PUBLISH_FEE}', '{END_PUBLISH_FEE}', '{START_PREMIUM_FEE}', '{END_PREMIUM_FEE}');
    $words[] = array($item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], osc_base_url(), $item['s_title'], $item_url, osc_page_title(), '<a href="' . $publish_url . '">' . $publish_url . '</a>', $publish_url, '<a href="' . $premium_url . '">' . $premium_url . '</a>', $premium_url, '', '', '', '');
    if ($email['b_publish'] == 0) {
        $content['s_text'] = preg_replace('|{START_PUBLISH_FEE}(.*){END_PUBLISH_FEE}|', '', $content['s_text']);
    }
    if ($email['b_premium'] == 0) {
        $content['s_text'] = preg_replace('|{START_PREMIUM_FEE}(.*){END_PREMIUM_FEE}|', '', $content['s_text']);
    }
    $title = osc_apply_filter('alert_email_payment_pro_title_after', osc_mailBeauty(osc_apply_filter('email_payment_pro_title', osc_apply_filter('alert_email_payment_pro_title', $content['s_title'], $email, $item)), $words), $email, $item);
    $body = osc_apply_filter('alert_email_payment_pro_description_after', osc_mailBeauty(osc_apply_filter('email_payment_pro_description', osc_apply_filter('alert_email_payment_pro_description', $content['s_text'], $email, $item)), $words), $email, $item);
    $emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
    osc_sendMail($emailParams);
}
Exemple #19
0
   <?php 
if (nc_osc_mark_status(osc_item_id())) {
    $status = "true";
} else {
    $status = "false";
}
?>
    <form name="mas" id="mas" action="<?php 
echo osc_route_url('mark-as-sold');
?>
" method="post">
        <input type="hidden" name="itemId" id="itemId" value='<?php 
echo osc_item_id();
?>
'>
        <input type="hidden" name="return_url" id="return_url" value="<?php 
echo osc_item_url();
?>
">
        <input type="hidden" name="mark-it" id="mark-it" value="<?php 
echo $status;
?>
">
        <?php 
if (nc_osc_mark_status(osc_item_id())) {
    ?>
        <button class="btn btn-primary" type="submit" name="mark_as_sold" id="mark_as_sold" value="MAS">Unmark Sold Status</button>
        <?php 
} else {
    ?>
        <button class="btn btn-primary" type="submit" name="mark_as_sold" value="MAS" id="mark_as_sold">Mark As Sold</button>
Exemple #20
0
        ?>
">Edit</a></span></td>
                                                    <td>
                                                    <td>
                                                        <?php 
        if (osc_item_is_premium()) {
            ?>
                                                            <h5>Premium Item</h5>
                                                            <?php 
        } else {
            ?>
                                                            <?php 
            if (nc_osc_premium_fee_enabled()) {
                ?>
                                                                <h5><a style="text-decoration:underline;" href="<?php 
                echo osc_route_url('payment-publish', array('itemId' => osc_item_id()));
                ?>
">Mark Premium</a></h5>
                                                            <?php 
            }
            ?>
                                                        <?php 
        }
        ?>
                                                    </td>
                                                </tr>
                                            <?php 
    }
    ?>
                                        <?php 
}
Exemple #21
0
                ?>
"><?php 
                _e('Make premium', 'payment');
                ?>
</a></strong>
                            <?php 
            }
            ?>
                        <?php 
        }
        ?>
                    </p>
                    <br />
            </div>
    <?php 
    }
    ?>
    <br />
    <div class="paginate">
    <?php 
    for ($i = 0; $i < osc_list_total_pages(); $i++) {
        if ($i == osc_list_page()) {
            printf('<a class="searchPaginationSelected" href="%s">%d</a>', osc_route_url('payment-user-menu-page', array('iPage' => $i)), $i + 1);
        } else {
            printf('<a class="searchPaginationNonSelected" href="%s">%d</a>', osc_route_url('payment-user-menu-page', array('iPage' => $i)), $i + 1);
        }
    }
    ?>
    </div>
<?php 
}
 public static function ajaxPayment()
 {
     $status = self::processPayment();
     $data = payment_get_custom(Params::getParam('extra'));
     $product_type = explode('x', $data['product']);
     if ($status == PAYMENT_COMPLETED) {
         osc_add_flash_ok_message(sprintf(__('Success! Please write down this transaction ID in case you have any problem: %s', 'payment'), Params::getParam('stripe_transaction_id')));
         if ($product_type[0] == 101) {
             $item = Item::newInstance()->findByPrimaryKey($product_type[2]);
             $category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
             View::newInstance()->_exportVariableToView('category', $category);
             payment_js_redirect_to(osc_search_category_url());
         } else {
             if ($product_type[0] == 201) {
                 if (osc_is_web_user_logged_in()) {
                     payment_js_redirect_to(osc_route_url('payment-user-menu'));
                 } else {
                     View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
                     payment_js_redirect_to(osc_item_url());
                 }
             } else {
                 if (osc_is_web_user_logged_in()) {
                     payment_js_redirect_to(osc_route_url('payment-user-pack'));
                 } else {
                     // THIS SHOULD NOT HAPPEN
                     payment_js_redirect_to(osc_base_path());
                 }
             }
         }
     } else {
         if ($status == PAYMENT_ALREADY_PAID) {
             osc_add_flash_warning_message(__('Warning! This payment was already paid', 'payment'));
         } else {
             osc_add_flash_error_message(_e('There were an error processing your payment', 'payment'));
         }
         if ($product_type[0] == 301) {
             if (osc_is_web_user_logged_in()) {
                 payment_js_redirect_to(osc_route_url('payment-user-pack'));
             } else {
                 // THIS SHOULD NOT HAPPEN
                 payment_js_redirect_to(osc_base_path());
             }
         } else {
             if (osc_is_web_user_logged_in()) {
                 payment_js_redirect_to(osc_route_url('payment-user-menu'));
             } else {
                 View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
                 payment_js_redirect_to(osc_item_url());
             }
         }
     }
 }
Exemple #23
0
        ?>
">   
                                <div class="form-group">    
                                    <input type="number" name="demand" id="demand" max="<?php 
        echo StockInHand::newInstance()->getStock(osc_item_id());
        ?>
" required>     
                                </div>
                                <?php 
    }
    ?>
                                <button class="btn btn-primary" type="submit" name="add_to_cart">Add to Cart</button>
                            </form>
                            </div>
                            <form name="check-out" action="<?php 
    echo osc_route_url("check-out");
    ?>
" method="post">
                                <button class="btn btn-success" type="submit" name="check-out">Checkout</button>    
                            </form>
                        </div>
                    </div>
                <?php 
}
?>
            </div>
        </div>
        <?php 
osc_current_web_theme_path('footer.php');
?>
    </body>
Exemple #24
0
<?php

$data = payment_get_custom(Params::getParam('extra'));
$product_type = explode('x', Params::getParam('item_number'));
osc_add_flash_info_message(__('We are processing your payment, if we did not finish in a few minutes, please contact us', 'payment'));
if ($product_type[0] == 301) {
    if (osc_is_web_user_logged_in()) {
        osc_redirect_to(osc_route_url('payment-user-pack'));
    } else {
        // THIS SHOULD NOT HAPPEN
        osc_redirect_to(osc_base_path());
    }
} else {
    if (osc_is_web_user_logged_in()) {
        osc_redirect_to(osc_route_url('payment-user-menu'));
    } else {
        View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
        osc_redirect_to(osc_item_url());
    }
}
    public static function button($products, $extra = null)
    {
        $items = array();
        $amount = 0;
        foreach ($products as $p) {
            $amount += $p['amount'] * $p['quantity'];
        }
        if (osc_get_preference('currency', 'payment_pro') != 'BTC') {
            $amount = osc_file_get_contents("https://blockchain.info/tobtc?currency=" . osc_get_preference('currency', 'payment_pro') . "&value=" . $amount);
            $xrate = osc_file_get_contents("https://blockchain.info/tobtc?currency=" . osc_get_preference('currency', 'payment_pro') . "&value=1");
            if (is_numeric($xrate)) {
                $extra['xrate'] = $xrate;
                osc_set_preference('blockchain_xrate', $xrate, 'payment_pro');
            } else {
                osc_get_preference('blockchain_xrate', 'payment_pro');
            }
        } else {
            $extra['xrate'] = 1;
        }
        $tx_id = ModelPaymentPro::newInstance()->pendingInvoice($products);
        $r = rand(0, 1000);
        $extra['random'] = $r;
        $extra['tx'] = $tx_id;
        $extra = payment_pro_set_custom($extra);
        ?>
            <li class="payment bitcoin-btn">
            <div class="blockchain-btn"
            data-address="<?php 
        echo osc_get_preference('blockchain_btc_address', 'payment_pro');
        ?>
"
            data-anonymous="false"
            data-callback="<?php 
        echo osc_route_url('blockchain-notify', array('extra' => str_replace("+", "@", $extra)));
        ?>
">
                <div  style="cursor:pointer;cursor:hand" class="blockchain stage-begin">
                    <img src="<?php 
        echo PAYMENT_PRO_URL;
        ?>
payments/blockchain/pay_now_64.png">
                </div>
                <div class="blockchain stage-loading" style="text-align:center">
                    <img src="<?php 
        echo PAYMENT_PRO_URL;
        ?>
payments/blockchain/loading-large.gif">
                </div>
                <div class="blockchain stage-ready">
                    <p align="center"><?php 
        printf(__('Please send %f BTC to <br /> <b>[[address]]</b></p>', 'payment_pro'), $amount);
        ?>
                    <p align="center" class="qr-code"></p>
                </div>
                <div class="blockchain stage-paid">
                    <p><?php 
        _e('Payment Received <b>[[value]] BTC</b>. Thank You.', 'payment_pro');
        ?>
</p>
                    <a href="<?php 
        echo osc_route_url('payment-pro-done', array('tx' => $tx_id));
        ?>
"><?php 
        _e('Click here to continue', 'payment_pro');
        ?>
</a>
                </div>
                <div class="blockchain stage-error">
                    <span color="red">[[error]]</span>
                </div>
            </div>
            </li>
        <?php 
    }