Skip to content

Commit

Permalink
Merge pull request #100 from mollie/2.3-8.4.0
Browse files Browse the repository at this point in the history
master -- Add support for Mollie API v2, add DE & ES language support and add EPS and Giropay payment methods
  • Loading branch information
QualityWorks-Dev authored Jul 24, 2018
2 parents 3079f13 + 08ad61b commit b6452a1
Show file tree
Hide file tree
Showing 105 changed files with 1,777 additions and 773 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
Expand All @@ -19,5 +18,5 @@ install:

script:
- composer validate --strict
- find admin catalog tests -name '*.php' | xargs -n 1 -P4 php -l
- find admin catalog -path catalog/controller/payment/mollie-api-client -prune -o -name '*.php' | xargs -n 1 -P4 php -l
- vendor/bin/phpunit -c tests/phpunit.xml
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@

#### Wijzigigen in versie 5.0
+ De module gebruikt nu de nieuwe betalings-API van Mollie. Dit betekent dat de module naast [iDEAL](https://www.mollie.com/ideal/), nu
ook [creditcard](https://www.mollie.com/creditcard/), [Mister Cash](https://www.mollie.com/mistercash/) en [paysafecard](https://www.mollie.com/paysafecard/)
ook [creditcard](https://www.mollie.com/creditcard/), [Mister Cash](https://www.mollie.com/bancontact/) en [paysafecard](https://www.mollie.com/paysafecard/)
ondersteunt. Mocht een betaling om wat voor reden dan ook niet lukken, dat kan uw klant het gelijk nog een keer proberen. U hoeft hiervoor niets extra's
te implementeren. In de toekomst zullen ook nog nieuwe betaalmethodes toegevoegd worden. Deze zijn dan direct beschikbaar in uw webshop.
+ Het instellingenscherm in de admin toont nu gelijk of de module correct kan communiceren met de Mollie API. Hierdoor kunnen we u beter helpen wanneer
Expand Down
25 changes: 17 additions & 8 deletions admin/controller/extension/payment/mollie/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
* @property URL $url
* @property User $user
*/
use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\Exceptions\IncompatiblePlatform;
use Mollie\Api\MollieApiClient;

require_once(dirname(DIR_SYSTEM) . "/catalog/controller/extension/payment/mollie/helper.php");

class ControllerExtensionPaymentMollieBase extends Controller
Expand All @@ -57,7 +61,7 @@ class ControllerExtensionPaymentMollieBase extends Controller

/**
* @param int $store The Store ID
* @return Mollie_API_Client
* @return MollieApiClient
*/
protected function getAPIClient ($store = 0)
{
Expand Down Expand Up @@ -102,7 +106,9 @@ public function cleanUp()
$catalogThemeDir = DIR_CATALOG . 'view/theme/default/template/extension/payment/';

// Remove old template from previous version.
unlink($adminThemeDir . 'mollie_2.tpl');
if (file_exists($adminThemeDir . 'mollie_2.tpl')) {
unlink($adminThemeDir . 'mollie_2.tpl');
}

if (MollieHelper::isOpenCart3x()) {
unlink($adminThemeDir . 'mollie_1.tpl');
Expand Down Expand Up @@ -408,7 +414,7 @@ public function index ()
$allowed_methods[] = $api_method->id;
}
}
catch (Mollie_API_Exception $e)
catch (Mollie\Api\Exceptions\ApiException $e)
{
// If we have an unauthorized request, our API key is likely invalid.
if ($data['stores'][$store['id']][$code . '_api_key'] !== NULL && strpos($e->getMessage(), "Unauthorized request") >= 0)
Expand Down Expand Up @@ -472,7 +478,10 @@ public function index ()
));
}

public function validate_api_key()
/**
*
*/
public function validate_api_key()
{
$json = array(
'error' => false,
Expand All @@ -497,10 +506,10 @@ public function validate_api_key()
$json['valid'] = true;
$json['message'] = 'Ok.';
}
} catch (Mollie_API_Exception_IncompatiblePlatform $e) {
} catch (IncompatiblePlatform $e) {
$json['error'] = true;
$json['message'] = $e->getMessage() . ' You can ask your hosting provider to help with this.';
} catch (Mollie_API_Exception $e) {
} catch (ApiException $e) {
$json['error'] = true;
$json['message'] = '<strong>Communicating with Mollie failed:</strong><br/>'
. htmlspecialchars($e->getMessage())
Expand Down Expand Up @@ -565,9 +574,9 @@ protected function checkCommunicationStatus ($api_key = null)
$client->methods->all();

return '<span style="color: green">OK</span>';
} catch (Mollie_API_Exception_IncompatiblePlatform $e) {
} catch (Mollie\Api\Exceptions\ApiException_IncompatiblePlatform $e) {
return '<span style="color:red">' . $e->getMessage() . ' You can ask your hosting provider to help with this.</span>';
} catch (Mollie_API_Exception $e) {
} catch (Mollie\Api\Exceptions\ApiException $e) {
return '<span style="color:red">'
. '<strong>Communicating with Mollie failed:</strong><br/>'
. htmlspecialchars($e->getMessage())
Expand Down
7 changes: 7 additions & 0 deletions admin/controller/extension/payment/mollie_bancontact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require_once(dirname(__FILE__) . "/mollie/base.php");

class ControllerExtensionPaymentMolliebancontact extends ControllerExtensionPaymentMollieBase
{
const MODULE_NAME = MollieHelper::MODULE_NAME_BANCONTACT;
}
7 changes: 0 additions & 7 deletions admin/controller/extension/payment/mollie_mistercash.php

This file was deleted.

122 changes: 122 additions & 0 deletions admin/language/de-de/extension/payment/mollie.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php
/**
* Copyright (c) 2012-2015, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* @package Mollie
* @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php
* @author Mollie B.V. <[email protected]>
* @copyright Mollie B.V.
* @link https://www.mollie.com
*/

// These are called automatically by the Payment modules list - do not change the names
$method_list_logo = '<a href="https://www.mollie.com" target="_blank"><img src="https://www.mollie.com/images/logo.png" alt="Mollie" title="Mollie" style="border:0px" /></a>';
$_['text_mollie_banktransfer'] = $method_list_logo;
$_['text_mollie_belfius'] = $method_list_logo;
$_['text_mollie_bitcoin'] = $method_list_logo;
$_['text_mollie_creditcard'] = $method_list_logo;
$_['text_mollie_directdebit'] = $method_list_logo;
$_['text_mollie_ideal'] = $method_list_logo;
$_['text_mollie_kbc'] = $method_list_logo;
$_['text_mollie_mistercash'] = $method_list_logo;
$_['text_mollie_paypal'] = $method_list_logo;
$_['text_mollie_paysafecard'] = $method_list_logo;
$_['text_mollie_sofort'] = $method_list_logo;
$_['text_mollie_giftcard'] = $method_list_logo;
$_['text_mollie_inghomepay'] = $method_list_logo;
$_['text_mollie_eps'] = $method_list_logo;
$_['text_mollie_giropay'] = $method_list_logo;

// Heading
$_['heading_title'] = "Mollie";
$_['title_global_options'] = "Einstellungen";
$_['title_payment_status'] = "Bezahlungs-Status";
$_['title_mod_about'] = "Über dieses Modul";
$_['footer_text'] = "Zahlungsdienste";

// Module names
$_['name_mollie_banktransfer'] = "Übertragung";
$_['name_mollie_belfius'] = "Belfius Direct Net";
$_['name_mollie_bitcoin'] = "Bitcoin";
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Einmaliges Inkasso";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC-Betaalknop";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
$_['name_mollie_sofort'] = "SOFORT Banking";
$_['name_mollie_giftcard'] = 'Giftcard';
$_['name_mollie_inghomepay'] = 'ING Home\'Pay';
$_['name_mollie_eps'] = 'EPS';
$_['name_mollie_giropay'] = 'Giropay';

// Text
$_['text_edit'] = "Mollie bearbeiten";
$_['text_payment'] = "Bezahlung";
$_['text_success'] = "Erfolg: Die Einstellungen für dieses Modul wurden angepasst!";
$_['text_missing_api_key'] = "Geben Sie den API Key ein.";
$_['text_activate_payment_method'] = 'Aktivieren Sie diese Zahlungsart über das <a href="https://www.mollie.com/beheer/account/profielen/" target="_blank">Mollie Dashboard</a>.';
$_['text_no_status_id'] = "- Status nicht ändern (nicht empfohlen) -";

// Entry
$_['entry_payment_method'] = "Zahlungsart";
$_['entry_activate'] = "Aktivieren";
$_['entry_sort_order'] = "Sortierreihenfolge";
$_['entry_api_key'] = "API Key";
$_['entry_description'] = "Beschreibung";
$_['entry_show_icons'] = "Icons anzeigen";
$_['entry_show_order_canceled_page'] = "Meldung bei annullierten Bezahlungen anzeigen";
$_['entry_geo_zone'] = "Geo Zone";

// Help
$_['help_view_profile'] = 'Sie können Ihren API Key auf <a href="https://www.mollie.com/beheer/account/profielen/" target="_blank" class="alert-link">Ihren Mollie-Webseiten-Profilen finden</a>.';
$_['help_status'] = "Das Modul aktivieren";
$_['help_api_key'] = "Geben Sie hier den <code>api_key</code> des Webseiten-Profils ein, das Sie verwenden wollen. Der API Key beginnt mit <code>test_</code> oder <code>live_</code>.";
$_['help_description'] = "Die Beschreibung soll auf der Banküberweisung Ihres Kunden erscheinen und Sie können sie in der Mollie Verwaltung sehen. Sie können maximal 29 Zeichen verwenden. TIPP: Verwenden Sie %, dies wird durch die Auftragsnummer ersetzt werden. Die Auftragsnummer selbst kann auch mehrere Zeichen lang sein!";
$_['help_show_icons'] = "Icons neben den Zahlungsarten von Mollie auf der Zahlungsseite anzeigen.";
$_['help_show_order_canceled_page'] = "Eine Meldung für den Kunden anzeigen, wenn eine Zahlung annulliert wurde, bevor der Kunde zurück zum Warenkorb verwiesen wird.";

// Info
$_['entry_module'] = "Module";
$_['entry_mod_status'] = "Modulestatus";
$_['entry_comm_status'] = "Kommunikationsstatus";
$_['entry_support'] = "Support";

$_['entry_version'] = '<a href="https://github.com/mollie/OpenCart/releases" target="_blank">Mollie Opencart</a>';

// Error
$_['error_permission'] = "Warnung: Sie haben keine Berechtigung, das Modul zu bearbeiten.";
$_['error_api_key'] = "Mollie API Key ist verpflichtend!";
$_['error_api_key_invalid'] = "Ungültiger Mollie API Key!";
$_['error_description'] = "Die Beschreibung ist obligatorisch!";
$_['error_file_missing'] = "Die Datei existiert nicht";

// Status
$_['entry_pending_status'] = "Status Zahlung erstellt";
$_['entry_failed_status'] = "Status Zahlung fehlgeschlagen";
$_['entry_canceled_status'] = "Status Zahlung annulliert";
$_['entry_expired_status'] = "Status Zahlung verstrichen";
$_['entry_processing_status']= "Status Zahlung erfolgreich";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_banktransfer'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_belfius.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_belfius'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_bitcoin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_bitcoin'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_creditcard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_creditcard'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_directdebit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_directdebit'];
3 changes: 3 additions & 0 deletions admin/language/de-de/extension/payment/mollie_eps.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
require(dirname(__FILE__) . "/mollie.php");
$_['heading_title'] .= " &ndash; " . $_['name_mollie_eps'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_giftcard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_giftcard'];
3 changes: 3 additions & 0 deletions admin/language/de-de/extension/payment/mollie_giropay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
require(dirname(__FILE__) . "/mollie.php");
$_['heading_title'] .= " &ndash; " . $_['name_mollie_giropay'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_ideal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_ideal'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_inghomepay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_inghomepay'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_kbc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_kbc'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_paypal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_paypal'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_paysafecard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_paysafecard'];
4 changes: 4 additions & 0 deletions admin/language/de-de/extension/payment/mollie_sofort.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_sofort'];
4 changes: 2 additions & 2 deletions admin/language/dutch/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$_['text_mollie_directdebit'] = $method_list_logo;
$_['text_mollie_ideal'] = $method_list_logo;
$_['text_mollie_kbc'] = $method_list_logo;
$_['text_mollie_mistercash'] = $method_list_logo;
$_['text_mollie_bancontact'] = $method_list_logo;
$_['text_mollie_paypal'] = $method_list_logo;
$_['text_mollie_paysafecard'] = $method_list_logo;
$_['text_mollie_sofort'] = $method_list_logo;
Expand All @@ -64,7 +64,7 @@
$_['name_mollie_directdebit'] = "Eenmalige incasso";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC-Betaalknop";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_bancontact'] = "bancontact";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
$_['name_mollie_sofort'] = "SOFORT Banking";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/dutch/extension/payment/mollie_bancontact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_bancontact'];
4 changes: 2 additions & 2 deletions admin/language/en-gb/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$_['text_mollie_directdebit'] = $method_list_logo;
$_['text_mollie_ideal'] = $method_list_logo;
$_['text_mollie_kbc'] = $method_list_logo;
$_['text_mollie_mistercash'] = $method_list_logo;
$_['text_mollie_bancontact'] = $method_list_logo;
$_['text_mollie_paypal'] = $method_list_logo;
$_['text_mollie_paysafecard'] = $method_list_logo;
$_['text_mollie_sofort'] = $method_list_logo;
Expand All @@ -64,7 +64,7 @@
$_['name_mollie_directdebit'] = "Direct debit";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC Payment Button";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_bancontact'] = "Bancontact";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
$_['name_mollie_sofort'] = "SOFORT Banking";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/en-gb/extension/payment/mollie_bancontact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_bancontact'];
4 changes: 2 additions & 2 deletions admin/language/english/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$_['text_mollie_directdebit'] = $method_list_logo;
$_['text_mollie_ideal'] = $method_list_logo;
$_['text_mollie_kbc'] = $method_list_logo;
$_['text_mollie_mistercash'] = $method_list_logo;
$_['text_mollie_bancontact'] = $method_list_logo;
$_['text_mollie_paypal'] = $method_list_logo;
$_['text_mollie_paysafecard'] = $method_list_logo;
$_['text_mollie_sofort'] = $method_list_logo;
Expand All @@ -62,7 +62,7 @@
$_['name_mollie_directdebit'] = "Direct debit";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC Payment Button";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_bancontact'] = "Bancontact";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
$_['name_mollie_sofort'] = "SOFORT Banking";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require(dirname(__FILE__) . "/mollie.php");

$_['heading_title'] .= " &ndash; " . $_['name_mollie_bancontact'];
Loading

0 comments on commit b6452a1

Please sign in to comment.