Example #1
0
 public function __construct()
 {
     parent::__construct();
     $this->id = 'skrill';
     $this->title = 'Skrill';
     $this->has_fields = false;
     $this->enabled = FFLCommerce_Base::get_options()->get_option('fflcommerce_skrill_enabled');
     $this->title = FFLCommerce_Base::get_options()->get_option('fflcommerce_skrill_title');
     $this->email = FFLCommerce_Base::get_options()->get_option('fflcommerce_skrill_email');
     $this->locale = $this->getLocale();
     $skrillIcon = FFLCommerce_Base::get_options()->get_option('fflcommerce_skrill_icon');
     if (!filter_var($skrillIcon, FILTER_VALIDATE_URL)) {
         $this->icon = fflcommerce::assets_url() . '/assets/images/icons/skrill.png';
     } else {
         $this->icon = $skrillIcon;
     }
     $pMeth = (array) FFLCommerce_Base::get_options()->get_option('fflcommerce_skrill_payment_methods_multicheck');
     $cList = '';
     foreach ($pMeth as $key => $value) {
         if ($value) {
             $cList = $cList . $key . ',';
         }
     }
     $cList = rtrim($cList, ",");
     $this->payment_methods = $cList;
     add_action('init', array($this, 'check_status_response'));
     if (isset($_GET['skrillPayment']) && $_GET['skrillPayment'] == true) {
         add_action('init', array($this, 'generate_skrill_form'));
     }
     add_action('valid-skrill-status-report', array($this, 'successful_request'));
     add_action('receipt_skrill', array($this, 'receipt_skrill'));
 }
function fflcommerce_enqueue_product_quick_scripts()
{
    global $pagenow, $typenow;
    if (empty($typenow) && !empty($_GET['post'])) {
        $post = get_post($_GET['post']);
        $typenow = $post->post_type;
    }
    if ($typenow == 'product') {
        wp_enqueue_script('fflcommerce-admin-quickedit', fflcommerce::assets_url() . '/assets/js/product_quick_edit.js', array('jquery', 'inline-edit-post'), '', true);
        $fflcommerce_quick_edit_params = array('assets_url' => fflcommerce::assets_url(), 'ajax_url' => !is_ssl() ? str_replace('https', 'http', admin_url('admin-ajax.php')) : admin_url('admin-ajax.php'), 'get_stock_price_nonce' => wp_create_nonce("get-product-stock-price"), 'update_stock_price_nonce' => wp_create_nonce("update-product-stock-price"));
        wp_localize_script('fflcommerce-admin-quickedit', 'fflcommerce_quick_edit_params', $fflcommerce_quick_edit_params);
    }
}
Example #3
0
 /**
  *  Default Option settings for WordPress Settings API using the FFLCommerce_Options class
  *
  *  These will be installed on the FFLCommerce_Options 'Payment Gateways' tab by the parent class 'fflcommerce_payment_gateway'
  */
 protected function get_default_options()
 {
     $defaults = array();
     // Define the Section name for the FFLCommerce_Options
     $defaults[] = array('name' => sprintf(__('FuturePay %s', 'fflcommerce'), '<img style="vertical-align:middle;margin-top:-4px;margin-left:10px;" src="' . fflcommerce::assets_url() . '/assets/images/icons/futurepay.png" alt="FuturePay">'), 'type' => 'title', 'desc' => sprintf(__('This module allows you to accept online payments via %s allowing customers to buy now and pay later without a credit card.  FuturePay is a safe, convenient and secure way for US customers to buy online in one-step.  %s', 'fflcommerce'), '<a href="http://www.futurepay.com/" target="_blank">' . __('FuturePay', 'fflcommerce') . '</a>', '<a href="https://www.futurepay.com/main/merchant-signup?platform=77_FPM495845-1" target="_blank">' . __('Signup for a Merchant Account', 'fflcommerce') . '</a>'));
     // List each option in order of appearance with details
     $defaults[] = array('name' => __('Enable FuturePay', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_futurepay_enabled', 'std' => 'no', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce')));
     $defaults[] = array('name' => __('Method Title', 'fflcommerce'), 'desc' => '', 'tip' => __('This controls the title which the user sees during checkout.', 'fflcommerce'), 'id' => 'fflcommerce_futurepay_title', 'std' => __('FuturePay', 'fflcommerce'), 'type' => 'text');
     $defaults[] = array('name' => __('Customer Message', 'fflcommerce'), 'desc' => '', 'tip' => __('This controls the description which the user sees during checkout.', 'fflcommerce'), 'id' => 'fflcommerce_futurepay_description', 'std' => __('Pay with FuturePay. Buy now and pay later. No credit card needed.  You will be asked to enter your FuturePay username and password, or create an account when you Place your Order.', 'fflcommerce'), 'type' => 'longtext');
     $defaults[] = array('name' => __('Merchant API Key', 'fflcommerce'), 'desc' => '', 'tip' => __('Your unique FuturePay Merchant Identifier is provided to you when you create a Merchant Account with FuturePay.', 'fflcommerce'), 'id' => 'fflcommerce_futurepay_gmid', 'std' => '', 'type' => 'longtext');
     $defaults[] = array('name' => __('Enable Sandbox', 'fflcommerce'), 'desc' => __('Turn on to enable the FuturePay sandbox for testing.', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_futurepay_mode', 'std' => 'no', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce')));
     return $defaults;
 }
/**
 * Settings page
 *
 * Handles the display of the settings page in admin.
 *
 * @since 		1.0
 * @usedby 		fflcommerce_admin_menu2()
 */
function fflcommerce_settings()
{
    global $fflcommerce_options_settings;
    ?>
    <script type="text/javascript" src="<?php 
    echo fflcommerce::assets_url();
    ?>
/assets/js/bootstrap-tooltip.min.js"></script>
    <div class="wrap fflcommerce">
        <div class="icon32 icon32-fflcommerce-settings" id="icon-fflcommerce"><br/></div>
        <?php 
    do_action('fflcommerce_admin_settings_notices');
    ?>
        <form method="post" id="mainform" action="">
        	<?php 
    wp_nonce_field('fflcommerce-update-settings', '_fflcommerce_csrf');
    ?>
    		<?php 
    fflcommerce_admin_fields($fflcommerce_options_settings);
    ?>
            <input name="submitted" type="hidden" value="yes" />
        </form>
    </div>
    <?php 
}
Example #5
0
 /**
  *  Default Option settings for WordPress Settings API using the FFLCommerce_Options class
  *  These will be installed on the FFLCommerce_Options 'Payment Gateways' tab by the parent class 'fflcommerce_payment_gateway'
  */
 protected function get_default_options()
 {
     return array(array('name' => sprintf(__('WorldPay %s', 'fflcommerce'), '<img style="vertical-align:middle;margin-top:-4px;margin-left:10px;" src="' . fflcommerce::assets_url() . '/assets/images/icons/worldpay.png" alt="WorldPay">'), 'type' => 'title', 'desc' => sprintf(__("To ensure your <strong>Preferential FFL Commerce Partner Rates</strong>, please complete your %s.  Merchants who fail to register here will be put on WorldPay standard new business accounts which carry higher rates.<br/><br/>The WorldPay gateway uses a Dynamic Response URL. You <strong>must activate</strong> this in your %s with the following:<br/>1) Go to <strong>WorldPay Merchant Interface -> Installations -> Integration Setup (TEST / PRODUCTION)</strong><br/>2) Check the <strong>Payment Response enabled?</strong> checkbox. <br/>3) Copy and Paste the full tag in bold <strong>&lt;wpdisplay item=MC_callback&gt;</strong> to the <strong>Payment Response URL</strong> input field.<br/>4) Check the <strong>Enable the Shopper Response</strong> checkbox. <br/>5) Save Changes.", 'fflcommerce'), '<a href="https://business.worldpay.com/partner/fflcommerce" target="_blank">WorldPay Merchant registration here</a>', '<a href="https://secure.worldpay.com/sso/public/auth/login.html?serviceIdentifier=merchantadmin" target="_blank">WorldPay Merchant Account</a>')), array('name' => __('Enable WorldPay', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_worldpay_is_enabled', 'std' => 'no', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Method Title', 'fflcommerce'), 'desc' => '', 'tip' => __('This controls the title which the user sees during checkout and also appears as the Payment Method on final Orders.', 'fflcommerce'), 'id' => 'fflcommerce_worldpay_method_title', 'std' => __('Credit Card via WorldPay', 'fflcommerce'), 'type' => 'text'), array('name' => __('Description', 'fflcommerce'), 'desc' => '', 'tip' => __('This controls the description which the user sees during checkout.', 'fflcommerce'), 'id' => 'fflcommerce_worldpay_checkout_description', 'std' => __("When you Place your Order, you will be directed to the secured WorldPay servers to enter your credit card information.  (Your Billing Address above must match that used on your Credit Card)", 'fflcommerce'), 'type' => 'textarea'), array('name' => __('Enable WorldPay Test Mode', 'fflcommerce'), 'desc' => 'Enable to make test transactions.', 'tip' => '', 'id' => 'fflcommerce_worldpay_test_mode', 'std' => 'no', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Installation ID', 'fflcommerce'), 'desc' => '', 'tip' => __('Please enter your WorldPay Installation ID.', 'fflcommerce'), 'id' => 'fflcommerce_worldpay_install_id', 'std' => '', 'type' => 'text'), array('name' => __('Payment Response Password', 'fflcommerce'), 'desc' => '', 'tip' => __("This option adds an additional security check to the Payment Response sent from WorldPay to FFL Commerce, to help validate that the Payment has been sent from WorldPay<br/>1. Add a <strong>'Payment Response Password'</strong> here <br/>2. Add the password in <strong>Merchant Interface->Installations->Integration Setup (TEST or PRODUCTION)-><em>Payment Response Password</em></strong> field.<br/>Leave both empty to skip this check.", 'fflcommerce'), 'id' => 'fflcommerce_worldpay_response_password', 'std' => '', 'type' => 'text'), array('name' => __('Use MD5 SignatureFields', 'fflcommerce'), 'desc' => 'The phrase to copy: <strong>instId:cartId:amount:currency</strong>', 'tip' => __("This option enables you to use a 'MD5 + secret word' encrypted signature before sending order details to WorldPay as a measure against unauthorized tampering.<br/>The signature will encrypt the mandatory parameters (Installation Id, Order Id, amount, currency).<br/>To enable:<br/>1) Copy the exact phrase (case sensitive, in bold) shown under the setting checkbox.<br>2) Paste into your <strong>WorldPay Merchant Interface -> Installations -> Integration Setup (TEST or PRODUCTION) -><em>SignatureFields</em></strong> input box and also enable this setting checkbox.<br>2) You must also enter a <strong>Secret Word</strong> in the next setting and save the settings.", 'fflcommerce'), 'id' => 'fflcommerce_worldpay_md5', 'std' => 'yes', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Secret Word', 'fflcommerce'), 'desc' => '', 'tip' => __("<strong>(REQUIRED IF MD5 SIGNATURE IS ENABLED)</strong> Enter here the Secret Word you will use to hash the MD5 signature. The word needs to be up to 16 characters, known only to yourself and to WorldPay.<br/> This secret must also be entered into the <strong>WorldPay Merchant Interface -> Installations -> Integration Setup (TEST or PRODUCTION) -><em>MD5 secret for transactions</em></strong> field.", 'fflcommerce'), 'id' => 'fflcommerce_worldpay_md5_secret_word', 'std' => '', 'type' => 'text'), array('name' => __('Fixed Payment Currency', 'fflcommerce'), 'desc' => '', 'tip' => __('This option hides the currency menu on the WorldPay page, which will fix the currency that the shopper must purchase in.<br/><b>The currency submitted is the main currency of your Shop.</b>  With this option disabled, customers will be able to select their currency and see the corrected price for the Order.', 'fflcommerce'), 'id' => 'fflcommerce_worldpay_fixed_currency', 'std' => 'no', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Receive Error Logs', 'fflcommerce'), 'desc' => '', 'tip' => __("Do you want to receive emails for the error logs from FFL Commerce security/fraud checks.", 'fflcommerce'), 'id' => 'fflcommerce_worldpay_receive_security_logs', 'std' => 'yes', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Email error logs to', 'fflcommerce'), 'desc' => '', 'tip' => __('Email address you want to receive all error logs to. If email field is empty, the FFL Commerce email address will be used.', 'fflcommerce'), 'id' => 'fflcommerce_worldpay_security_logs_emailto', 'std' => '', 'type' => 'email'));
 }
function fflcommerce_custom_product_columns($column)
{
    global $post;
    $fflcommerce_options = FFLCommerce_Base::get_options();
    $product = new fflcommerce_product($post->ID);
    switch ($column) {
        case "thumb":
            if ('trash' != $post->post_status) {
                echo '<a class="row-title" href="' . get_edit_post_link($post->ID) . '">';
                echo fflcommerce_get_product_thumbnail('admin_product_list');
                echo '</a>';
            } else {
                echo fflcommerce_get_product_thumbnail('admin_product_list');
            }
            break;
        case "price":
            echo $product->get_price_html();
            break;
        case "featured":
            $url = wp_nonce_url(admin_url('admin-ajax.php?action=fflcommerce-feature-product&product_id=' . $post->ID));
            echo '<a href="' . esc_url($url) . '" title="' . __('Change', 'fflcommerce') . '">';
            if ($product->is_featured()) {
                echo '<a href="' . esc_url($url) . '"><img src="' . fflcommerce::assets_url() . '/assets/images/head_featured_desc.png" alt="yes" />';
            } else {
                echo '<img src="' . fflcommerce::assets_url() . '/assets/images/head_featured.png" alt="no" />';
            }
            echo '</a>';
            break;
        case "stock":
            if (!$product->is_type('grouped') && $product->is_in_stock()) {
                if ($product->managing_stock()) {
                    if ($product->is_type('variable') && $product->stock > 0) {
                        echo $product->stock . ' ' . __('In Stock', 'fflcommerce');
                    } else {
                        if ($product->is_type('variable')) {
                            $stock_total = 0;
                            foreach ($product->get_children() as $child_ID) {
                                $child = $product->get_child($child_ID);
                                $stock_total += (int) $child->stock;
                            }
                            echo $stock_total . ' ' . __('In Stock', 'fflcommerce');
                        } else {
                            echo $product->stock . ' ' . __('In Stock', 'fflcommerce');
                        }
                    }
                } else {
                    echo __('In Stock', 'fflcommerce');
                }
            } elseif ($product->is_type('grouped')) {
                echo __('Parent (no stock)', 'fflcommerce');
            } else {
                echo '<strong class="attention">' . __('Out of Stock', 'fflcommerce') . '</strong>';
            }
            break;
        case "product-type":
            echo __(ucwords($product->product_type), 'fflcommerce');
            echo '<br/>';
            if ($fflcommerce_options->get('fflcommerce_enable_sku', true) == 'yes' && ($sku = get_post_meta($post->ID, 'sku', true))) {
                echo $sku;
            } else {
                echo $post->ID;
            }
            break;
        case "product-date":
            if ('0000-00-00 00:00:00' == $post->post_date) {
                $t_time = $h_time = __('Unpublished', 'fflcommerce');
                $time_diff = 0;
            } else {
                $t_time = get_the_time(__('Y/m/d g:i:s A', 'fflcommerce'));
                $m_time = $post->post_date;
                $time = get_post_time('G', true, $post);
                $time_diff = time() - $time;
                if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                    $h_time = sprintf(__('%s ago', 'fflcommerce'), human_time_diff($time));
                } else {
                    $h_time = mysql2date(__('Y/m/d', 'fflcommerce'), $m_time);
                }
            }
            echo '<abbr title="' . esc_attr($t_time) . '">' . apply_filters('post_date_column_time', $h_time, $post) . '</abbr><br />';
            if ('publish' == $post->post_status) {
                _e('Published', 'fflcommerce');
            } elseif ('future' == $post->post_status) {
                if ($time_diff > 0) {
                    echo '<strong class="attention">' . __('Missed schedule', 'fflcommerce') . '</strong>';
                } else {
                    _e('Scheduled', 'fflcommerce');
                }
            } else {
                _e('Draft', 'fflcommerce');
            }
            if ($product->visibility) {
                echo $product->visibility != 'visible' ? '<br /><strong class="attention">' . ucfirst($product->visibility) . '</strong>' : '';
            }
            break;
        case "product-visibility":
            if ($product->visibility) {
                echo $product->visibility == 'Hidden' ? '<strong class="attention">' . ucfirst($product->visibility) . '</strong>' : ucfirst($product->visibility);
            }
            break;
    }
}