Skip to content

Commit

Permalink
Merge pull request #52 from ndijkstra/opencart-2.3
Browse files Browse the repository at this point in the history
Add KBC/CBC Payment Button for Opencart 2.3
  • Loading branch information
mollierobbert authored Oct 12, 2016
2 parents 69ec85c + 4d72b64 commit c36c8f1
Show file tree
Hide file tree
Showing 55 changed files with 718 additions and 25 deletions.
7 changes: 7 additions & 0 deletions admin/controller/extension/payment/mollie_kbc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require_once(dirname(__FILE__) . "/mollie/base.php");

class ControllerExtensionPaymentMollieKbc extends ControllerExtensionPaymentMollieBase
{
const MODULE_NAME = MollieHelper::MODULE_NAME_KBC;
}
2 changes: 2 additions & 0 deletions admin/language/dutch/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$_['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;
Expand All @@ -58,6 +59,7 @@
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Eenmalige incasso";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC-Betaalknop";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/dutch/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'];
2 changes: 2 additions & 0 deletions admin/language/en-gb/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$_['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;
Expand All @@ -58,6 +59,7 @@
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Direct debit";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC Payment Button";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/en-gb/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'];
2 changes: 2 additions & 0 deletions admin/language/english/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$_['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;
Expand All @@ -58,6 +59,7 @@
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Direct debit";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC Payment Button";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/english/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'];
2 changes: 2 additions & 0 deletions admin/language/fr-fr/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$_['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;
Expand All @@ -58,6 +59,7 @@
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Débit direct";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "Bouton de paiement KBC/CBC";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/fr-fr/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'];
2 changes: 2 additions & 0 deletions admin/language/french/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$_['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;
Expand All @@ -58,6 +59,7 @@
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Débit direct";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "Bouton de paiement KBC/CBC";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/french/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'];
2 changes: 2 additions & 0 deletions admin/language/nl-nl/extension/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$_['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;
Expand All @@ -58,6 +59,7 @@
$_['name_mollie_creditcard'] = "Creditcard";
$_['name_mollie_directdebit'] = "Eenmalige incasso";
$_['name_mollie_ideal'] = "iDEAL";
$_['name_mollie_kbc'] = "KBC/CBC-Betaalknop";
$_['name_mollie_mistercash'] = "Bancontact/MisterCash";
$_['name_mollie_paypal'] = "PayPal";
$_['name_mollie_paysafecard'] = "paysafecard";
Expand Down
4 changes: 4 additions & 0 deletions admin/language/nl-nl/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'];
Empty file.
64 changes: 55 additions & 9 deletions catalog/controller/extension/payment/mollie-api-client/src/Mollie/API/Client.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Mollie_API_Client
/**
* Version of our client.
*/
const CLIENT_VERSION = "1.4.1";
const CLIENT_VERSION = "1.7.1";

/**
* Endpoint of the remote API.
Expand Down Expand Up @@ -104,6 +104,16 @@ class Mollie_API_Client
*/
public $profiles;

/**
* RESTful refunds resource. NOTE: requires OAuth access token.
*
* If you wish to create / get / list / cancel refunds with an API key, use the payment_refunds resource
*
* @see $payments_refunds
* @var Mollie_API_Resource_Refunds
*/
public $refunds;

/**
* RESTful Settlements resource. NOTE: requires OAuth access token.
*
Expand All @@ -125,6 +135,20 @@ class Mollie_API_Client
*/
public $customers_payments;

/**
* RESTful Customers Mandates resource.
*
* @var Mollie_API_Resource_Customers_Mandates
*/
public $customers_mandates;

/**
* RESTful Customers Subscriptions resource.
*
* @var Mollie_API_Resource_Customers_Subscriptions
*/
public $customers_subscriptions;

/**
* @var string
*/
Expand All @@ -147,6 +171,11 @@ class Mollie_API_Client
*/
protected $ch;

/**
* @var string
*/
protected $pem_path;

/**
* @throws Mollie_API_Exception_IncompatiblePlatform
*/
Expand All @@ -155,16 +184,19 @@ public function __construct ()
$this->getCompatibilityChecker()
->checkCompatibility();

$this->payments = new Mollie_API_Resource_Payments($this);
$this->payments_refunds = new Mollie_API_Resource_Payments_Refunds($this);
$this->issuers = new Mollie_API_Resource_Issuers($this);
$this->methods = new Mollie_API_Resource_Methods($this);
$this->customers = new Mollie_API_Resource_Customers($this);
$this->customers_payments = new Mollie_API_Resource_Customers_Payments($this);
$this->payments = new Mollie_API_Resource_Payments($this);
$this->payments_refunds = new Mollie_API_Resource_Payments_Refunds($this);
$this->issuers = new Mollie_API_Resource_Issuers($this);
$this->methods = new Mollie_API_Resource_Methods($this);
$this->customers = new Mollie_API_Resource_Customers($this);
$this->customers_payments = new Mollie_API_Resource_Customers_Payments($this);
$this->customers_mandates = new Mollie_API_Resource_Customers_Mandates($this);
$this->customers_subscriptions = new Mollie_API_Resource_Customers_Subscriptions($this);

// OAuth2 endpoints
$this->permissions = new Mollie_API_Resource_Permissions($this);
$this->organizations = new Mollie_API_Resource_Organizations($this);
$this->refunds = new Mollie_API_Resource_Refunds($this);
$this->profiles = new Mollie_API_Resource_Profiles($this);
$this->settlements = new Mollie_API_Resource_Settlements($this);

Expand All @@ -174,6 +206,9 @@ public function __construct ()
$this->addVersionString("PHP/" . phpversion());
$this->addVersionString("cURL/" . $curl_version["version"]);
$this->addVersionString($curl_version["ssl_version"]);

// The PEM path may be overwritten with setPemPath().
$this->pem_path = realpath(dirname(__FILE__) . "/cacert.pem");
}

/**
Expand Down Expand Up @@ -254,6 +289,16 @@ public function addVersionString ($version_string)
$this->version_strings[] = str_replace(array(" ", "\t", "\n", "\r"), '-', $version_string);
}

/**
* Overwrite the default path to the PEM file. Should only be used by advanced users.
*
* @param string $pem_path
*/
public function setPemPath ($pem_path)
{
$this->pem_path = strval($pem_path);
}

/**
* Perform an http call. This method is used by the resource specific classes. Please use the $payments property to
* perform operations on payments.
Expand All @@ -274,7 +319,7 @@ public function performHttpCall ($http_method, $api_method, $http_body = NULL)
{
if (empty($this->api_key))
{
throw new Mollie_API_Exception("You have not set an API key. Please use setApiKey() to set the API key.");
throw new Mollie_API_Exception("You have not set an API key or OAuth access token. Please use setApiKey() to set the API key.");
}

if (empty($this->ch) || !function_exists("curl_reset"))
Expand Down Expand Up @@ -310,6 +355,7 @@ public function performHttpCall ($http_method, $api_method, $http_body = NULL)
"Authorization: Bearer {$this->api_key}",
"User-Agent: {$user_agent}",
"X-Mollie-Client-Info: " . php_uname(),
"Expect:",
);

curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $http_method);
Expand All @@ -329,7 +375,7 @@ public function performHttpCall ($http_method, $api_method, $http_body = NULL)
* On some servers, the list of installed certificates is outdated or not present at all (the ca-bundle.crt
* is not installed). So we tell cURL which certificates we trust.
*/
curl_setopt($this->ch, CURLOPT_CAINFO, realpath(dirname(__FILE__) . "/cacert.pem"));
curl_setopt($this->ch, CURLOPT_CAINFO, $this->pem_path);

$body = curl_exec($this->ch);

Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/**
* Copyright (c) 2016, 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.
*
* @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
*/
class Mollie_API_Object_Customer_Mandate
{
const STATUS_PENDING = "pending";
const STATUS_VALID = "valid";
const STATUS_INVALID = "invalid";

/**
* @var string
*/
public $resource;

/**
* @var string
*/
public $id;

/**
* @var string
*/
public $status;

/**
* @var string
*/
public $method;

/**
* @var string
*/
public $customerId;

/**
* @var object|null
*/
public $details;

/**
* @var string
*/
public $createdDatetime;

/**
* @return bool
*/
public function isValid ()
{
return $this->status === self::STATUS_VALID;
}
}
Loading

0 comments on commit c36c8f1

Please sign in to comment.