Code Monkey home page Code Monkey logo

pigmbhpaymill's Introduction

PAYMILL-Prestashop Extension for credit card and direct debit payments

PAYMILL extension for Prestashop compatible with: 1.5+ (tested for 1.5.5.0) and 1.6 (tested for 1.6.0.5). This extension installs two payment methods: Credit card and direct debit.

Your Advantages

  • PCI DSS compatibility
  • Payment means: Credit Card (Visa, Visa Electron, Mastercard, Maestro, Diners, Discover, JCB, AMEX, China Union Pay), Direct Debit (ELV)
  • Optional fast checkout configuration allowing your customers not to enter their payment detail over and over during checkout
  • Improved payment form with visual feedback for your customers
  • Supported Languages: German, English, Portuguese, Italian, French, Spanish
  • Backend Log with custom View accessible from your shop backend

Installation from this git repository

Download the complete module by using the link below:

Latest Version

  • Unzip the downloaded zip-file
  • Rename the folder to pigmbhpaymill
  • Zip the folder
  • Upload the zip-file to your prestashop
  • In your administration backend install the PigmbhPaymill plugin and go to the configuration section where you can insert your private and public key (that you can find in your Paymill cockpit https://app.paymill.de/).
  • Finally activate the plugin and customize it to your needs under Module > Module > PigmbhPaymill.

In case of errors

In case of any errors turn on the debug mode and logging in the PAYMILL Settings. Open the javascript console in your browser and check what's being logged during the checkout process. To access the logged information not printed in the console please refer to the Paymill Log in the admin backend.

Notes about the payment process

The payment is processed when an order is placed in the shop frontend.

Fast Checkout: Fast checkout can be enabled by selecting the option in the PAYMILL Basic Settings. If any customer completes a purchase while the option is active this customer will not be asked for data again. Instead a reference to the customer data will be saved allowing comfort during checkout.

pigmbhpaymill's People

Contributors

alexsimple avatar hiousi avatar kazemek avatar mmoustai avatar quetzacoalt91 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pigmbhpaymill's Issues

Changes for One-Page-Checkout

The function hookdisplayPaymentEU() currently only returns an array for each payment method which includes {'cta_text' => ..., 'logo' => ..., 'action' => ...} but in Version 1.6.1 there are new methods available. So this should be changed to {'cta_text' => ..., 'logo' => ..., 'form' => ...} including the form for each payment on the checkout page, so that a true OPC can be possible.

Order confirmation page

It would be great if you could display information relatives to the payment on the order confirmation page. Actually, if the customer faces an issue due to the payment or everything else it would be helpful for him/her to have details (reference, price, etc.).
Thank you.

Error while processing payment

When I tried to make a payment with paymill, I got the following error:
capture du 2014-08-20 10 44 30

I suppose we have two issues here, the first one is about the array_key_exists(), and the second one is about the unescaped strings sent to the log.
Maybe you should add a pSQL() on the data received.

CSS

/views/templates/front/paymentForm.tpl:
CSS files should be loaded within the hookHeader() using the $this->context->controller->addCSS() method.

<link rel="stylesheet" type="text/css" href="{$modul_base|escape:'UTF-8'}/css/paymill_styles.css" />

Defines

/pigmbhpaymill.php:
Since there is only a class in this file it's not required to do:

if (!defined('_PS_VERSION_'))
    exit;

cURL

/pigmbhpaymill.php:
The way you try to check if cURL is available is not valid:

if (!function_exists('curl_init'))
    exit;

The check should be done into the install() method. You should also display a warning message to inform the merchant what do to. If no warning message is displayed the merchant will not understand why the module cannot be installed.

Config form

No HTML should be generated within the controller:

    private function showConfigurationForm()
    {
    $configuration_model = $this->configuration_handler->loadConfiguration();
    return '<link rel="stylesheet" type="text/css" href="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/pigmbhpaymill/css/paymill_styles.css">
        <form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">
            <fieldset class="paymill_center">
                <legend>'.$this->displayName.'</legend>
                <table cellpadding="0" cellspacing="0">
                    <tr><td colspan="2" class="paymill_config_header">'.$this->l('config_payments').'</td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Activate creditcard-payment').'</td><td class="paymill_config_value">
                    <input type="checkbox" name="creditcard" '.$this->getCheckboxState($configuration_model->getCreditcard()).' /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Activate debit-payment').'</td><td class="paymill_config_value">
                    <input type="checkbox" name="debit" '.$this->getCheckboxState($configuration_model->getDirectdebit()).' /></td></tr>
                    <tr><td colspan="2" style="height: 15px;"></td></tr>
                    <tr><td colspan="2" class="paymill_config_header">'.$this->l('config_main').'</td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Private Key').'</td><td class="paymill_config_value">
                    <input type="text" class="paymill_config_text" name="privatekey" value="'.$configuration_model->getPrivateKey().'" /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Public Key').'</td><td class="paymill_config_value">
                    <input type="text" class="paymill_config_text" name="publickey" value="'.$configuration_model->getPublicKey().'" /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Days until the debit').'</td><td class="paymill_config_value">
                    <input type="text" class="paymill_config_text" name="debit_days" value="'.$configuration_model->getDebitDays().'" /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Activate debugging').'</td><td class="paymill_config_value">
                    <input type="checkbox" name="debug" '.$this->getCheckboxState($configuration_model->getDebug()).' /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Activate logging').'</td><td class="paymill_config_value">
                    <input type="checkbox" name="logging" '.$this->getCheckboxState($configuration_model->getLogging()).' /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Activate fastCheckout').'</td><td class="paymill_config_value">
                    <input type="checkbox" name="fastcheckout" '.$this->getCheckboxState($configuration_model->getFastcheckout()).' /></td></tr>
                    <tr><td class="paymill_config_label">'.$this->l('Accepted CreditCard Brands').'</td><td class="paymill_config_value">
                    <select multiple name="accepted_brands[]">'.$this->getAccepetdBrandOptions($configuration_model).'</select></td></tr>
                    <tr><td colspan="2" align="center"><input class="button" name="btnSubmit" value="'.$this->l('Save').'" type="submit" /></td></tr>
                </table>
            </fieldset>
        </form>';
    }

Everything should be place in a dedicated template. You can use Smarty to assign / display data.

JavaScript

/views/templates/front/paymentForm.tpl:
JS files should be loaded using the $this->context->controller->addJS() method.

<script type="text/javascript" src="https://bridge.paymill.com/"></script>
<script type="text/javascript" src="{$modul_base|escape:'UTF-8'}/js/Iban.js"></script>
<script type="text/javascript" src="{$modul_base|escape:'UTF-8'}/js/BrandDetection.js"></script>
<script type="text/javascript">
    function isSepa()
    {
        return !isNumber($('#paymill_iban').val().substr(0, 2));
    }

    function isNumber(n)
    {
        return !isNaN(parseFloat(n)) && isFinite(n);
    }

    function validate()
    {
        ...

Order state

You are putting data yourself in the database but PrestaShop already has methods for this.

public function updateOrderState($order_id)
    {
        $result = Db::getInstance()->executeS('SELECT `id_order_state` FROM `'._DB_PREFIX_
            .'order_state_lang` WHERE `template` = "refund" GROUP BY `template`;');
        $sql = 'INSERT INTO `'._DB_PREFIX_.'order_history` (`id_employee`,`id_order`,`id_order_state`,`date_add`) VALUES (0,%d, %d, NOW());';
        $order_state_id = (int)$result[0]['id_order_state'];
        $secure_sql = sprintf($sql, $order_id, $order_state_id);
        Db::getInstance()->execute($secure_sql);
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.