mirror of
https://github.com/0100Dev/WHMCS-Mollie-Payments.git
synced 2026-01-18 03:28:18 +01:00
Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.idea/
|
||||
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Installatie #
|
||||
+ ``` git clone git://github.com/0100Dev/WHMCS-Mollie.git ~/whmcs```
|
||||
+ Kopieer alle bestanden en mappen in ./modules/gateways/
|
||||
|
||||
# Ondersteunde betaalmethodes #
|
||||
Alle betaalmethodes van Mollie zijn ondersteund. Zet de gewenste betaalmethodes aan door de gateway in WHMCS te activeren.
|
||||
|
||||
# Support #
|
||||
W: 0100dev.nl
|
||||
E: support@0100dev.nl
|
||||
T: +31 (0)492 77 97 87
|
||||
|
||||
[Meer informatie via Mollie](https://www.mollie.nl/betaaldiensten/)
|
||||
|
||||

|
||||
BIN
mollie/ajax_loader.gif
Normal file
BIN
mollie/ajax_loader.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 404 B |
91
mollie/callback.php
Normal file
91
mollie/callback.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* Setting requirements and includes
|
||||
*
|
||||
*/
|
||||
require_once '../../../init.php';
|
||||
require_once 'vendor/Mollie/API/Autoloader.php';
|
||||
|
||||
$whmcs->load_function('gateway');
|
||||
$whmcs->load_function('invoice');
|
||||
|
||||
/**
|
||||
*
|
||||
* Check parameters
|
||||
*
|
||||
*/
|
||||
if(isset($_POST['id'])) {
|
||||
|
||||
// Get transaction
|
||||
$transactionQuery = select_query('gateway_mollie', '', array('paymentid' => $_POST['id']), null, null, 1);
|
||||
|
||||
if (mysql_num_rows($transactionQuery) != 1) {
|
||||
logTransaction($_GATEWAY['paymentmethod'], $_POST, 'Callback - Failure 2 (Transaction not found)');
|
||||
|
||||
header('HTTP/1.1 500 Transaction not found');
|
||||
exit();
|
||||
}
|
||||
|
||||
$transaction = mysql_fetch_assoc($transactionQuery);
|
||||
|
||||
$_GATEWAY = getGatewayVariables('mollie' . $transaction['method']);
|
||||
|
||||
if ($transaction['status'] != 'open') {
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 3 (Transaction not open)');
|
||||
|
||||
header('HTTP/1.1 500 Transaction not open');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Get user and transaction currencies
|
||||
$userCurrency = getCurrency($transaction['userid']);
|
||||
$transactionCurrency = select_query('tblcurrencies', '', array('id' => $transaction['currencyid']));
|
||||
$transactionCurrency = mysql_fetch_assoc($transactionCurrency);
|
||||
|
||||
// Check payment
|
||||
$mollie = new Mollie_API_Client;
|
||||
$mollie->setApiKey($_GATEWAY['key']);
|
||||
|
||||
$payment = $mollie->payments->get($_POST['id']);
|
||||
|
||||
if($payment->isPaid()) {
|
||||
|
||||
// Add conversion, when there is need to. WHMCS only supports currencies per user. WHY?!
|
||||
if ($transactionCurrency['id'] != $userCurrency['id']) {
|
||||
$transaction['amount'] = convertCurrency($transaction['amount'], $transaction['currencyid'], $userCurrency['id']);
|
||||
}
|
||||
|
||||
// Check invoice
|
||||
$invoiceid = checkCbInvoiceID($transaction['invoiceid'], $_GATEWAY['paymentmethod']);
|
||||
|
||||
checkCbTransID($transaction['paymentid']);
|
||||
|
||||
// Add invoice
|
||||
addInvoicePayment($invoiceid, $transaction['paymentid'], $transaction['amount'], '', $_GATEWAY['paymentmethod']);
|
||||
|
||||
update_query('gateway_mollie', array('status' => 'paid', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id']));
|
||||
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Paid)');
|
||||
|
||||
header('HTTP/1.1 200 OK');
|
||||
exit();
|
||||
} else if ($payment->isOpen() == FALSE) {
|
||||
update_query('gateway_mollie', array('status' => 'closed', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id']));
|
||||
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Closed)');
|
||||
|
||||
header('HTTP/1.1 200 OK');
|
||||
exit();
|
||||
} else {
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 1 (Payment not open or paid)');
|
||||
|
||||
header('HTTP/1.1 500 Payment not open or paid');
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
logTransaction('mollieunknown', $_POST, 'Callback - Failure 0 (Arg mismatch)');
|
||||
|
||||
header('HTTP/1.1 500 Arg mismatch');
|
||||
exit();
|
||||
}
|
||||
19
mollie/lang/dutch.php
Normal file
19
mollie/lang/dutch.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$_GATEWAYLANG = array();
|
||||
|
||||
$_GATEWAYLANG['selectBank'] = 'Selecteer bank';
|
||||
|
||||
$_GATEWAYLANG['errorTransactionNotFound'] = 'Transactie is niet gevonden. Probeer later opnieuw';
|
||||
|
||||
$_GATEWAYLANG['checkPayment'] = 'We controleren je betalen, even wachten.';
|
||||
|
||||
$_GATEWAYLANG['payWithBanktransfer'] = 'Betaal met Bank overschrijving';
|
||||
$_GATEWAYLANG['payWithBelfius'] = 'Betaal met Belfius';
|
||||
$_GATEWAYLANG['payWithBitcoin'] = 'Betaal met Bitcoin';
|
||||
$_GATEWAYLANG['payWithDirectdebit'] = 'Betaal met Automatisch Incasso';
|
||||
$_GATEWAYLANG['payWithIdeal'] = 'Betaal met iDeal';
|
||||
$_GATEWAYLANG['payWithMistercash'] = 'Betaal met Mistercash';
|
||||
$_GATEWAYLANG['payWithPaypal'] = 'Betaal met PayPal';
|
||||
$_GATEWAYLANG['payWithPaysafecard'] = 'Betaal met Paysafecard';
|
||||
$_GATEWAYLANG['payWithSofort'] = 'Betaal met Sofort Banking';
|
||||
20
mollie/lang/english.php
Normal file
20
mollie/lang/english.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$_GATEWAYLANG = array();
|
||||
|
||||
$_GATEWAYLANG['selectBank'] = 'Select bank';
|
||||
$_GATEWAYLANG['selectLater'] = 'Select later';
|
||||
|
||||
$_GATEWAYLANG['errorTransactionNotFound'] = 'Transaction is not found. Please try again.';
|
||||
|
||||
$_GATEWAYLANG['checkPayment'] = 'Checking your payment.. Please wait.';
|
||||
|
||||
$_GATEWAYLANG['payWithBanktransfer'] = 'Pay with Bank Transfer';
|
||||
$_GATEWAYLANG['payWithBelfius'] = 'Pay with Belfius';
|
||||
$_GATEWAYLANG['payWithBitcoin'] = 'Pay with Bitcoin';
|
||||
$_GATEWAYLANG['payWithDirectdebit'] = 'Pay with Direct Debit';
|
||||
$_GATEWAYLANG['payWithIdeal'] = 'Pay with iDeal';
|
||||
$_GATEWAYLANG['payWithMistercash'] = 'Pay with Mistercash';
|
||||
$_GATEWAYLANG['payWithPaypal'] = 'Pay with PayPal';
|
||||
$_GATEWAYLANG['payWithPaysafecard'] = 'Pay with Paysafecard';
|
||||
$_GATEWAYLANG['payWithSofort'] = 'Pay with Sofort Banking';
|
||||
124
mollie/mollie.php
Normal file
124
mollie/mollie.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
require_once 'vendor/Mollie/API/Autoloader.php';
|
||||
|
||||
function mollie_config() {
|
||||
return array(
|
||||
'key' => array(
|
||||
'FriendlyName' => 'API key',
|
||||
'Type' => 'text',
|
||||
'Size' => '35',
|
||||
'Description' => 'Your channel\'s API key.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function mollie_link($params, $method = Mollie_API_Object_Method::IDEAL) {
|
||||
global $whmcs;
|
||||
|
||||
/**
|
||||
*
|
||||
* Setting requirements and includes
|
||||
*
|
||||
*/
|
||||
if(substr($params['returnurl'], 0, 1) == '/')
|
||||
$params['returnurl'] = $params['systemurl'].$params['returnurl'];
|
||||
|
||||
if (empty($params['language']))
|
||||
$params['language'] = ((isset($_SESSION['language'])) ? $_SESSION['language'] : $whmcs->get_config('Language'));
|
||||
|
||||
if (empty($params['language']))
|
||||
$params['language'] = 'english';
|
||||
|
||||
if (!file_exists(__DIR__ . '/lang/' . $params['language'] . '.php'))
|
||||
$params['language'] = 'english';
|
||||
|
||||
/* @var array $_GATEWAYLANG */
|
||||
require __DIR__ . '/lang/' . $params['language'] . '.php';
|
||||
|
||||
$tableCheckQuery = full_query('SHOW TABLES LIKE \'gateway_mollie\'');
|
||||
|
||||
if (mysql_num_rows($tableCheckQuery) != 1) {
|
||||
full_query('CREATE TABLE IF NOT EXISTS `gateway_mollie` (`id` int(11) NOT NULL AUTO_INCREMENT, `paymentid` varchar(15), `amount` double NOT NULL, `currencyid` int(11) NOT NULL, `ip` varchar(50) NOT NULL, `userid` int(11) NOT NULL, `invoiceid` int(11) NOT NULL, `status` ENUM(\'open\',\'paid\',\'closed\') NOT NULL DEFAULT \'open\', `method` VARCHAR(25) NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `paymentid` (`paymentid`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;');
|
||||
}
|
||||
|
||||
$mollie = new Mollie_API_Client;
|
||||
$mollie->setApiKey($params['key']);
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if good state to open transaction.
|
||||
*
|
||||
*/
|
||||
if (isset($_GET['check_payment']) && ctype_digit($_GET['check_payment'])) {
|
||||
$transactionQuery = select_query('gateway_mollie', '', array('id' => $_GET['check_payment']), null, null, 1);
|
||||
|
||||
if (mysql_num_rows($transactionQuery) != 1) {
|
||||
return '<p>' . $_GATEWAYLANG['errorTransactionNotFound'] . '</p>';
|
||||
}
|
||||
|
||||
$transaction = mysql_fetch_assoc($transactionQuery);
|
||||
|
||||
if ($transaction['status'] == 'paid') {
|
||||
header('location: ' . $params['returnurl'] . '&paymentsuccess=true');
|
||||
exit();
|
||||
} else if ($transaction['status'] == 'closed') {
|
||||
header('location: ' . $params['returnurl'] . '&paymentfailed=true');
|
||||
exit();
|
||||
} else {
|
||||
return '<br/><img src="' . $params['systemurl'] . '/modules/gateways/mollie/ajax_loader.gif" /><br/>' . $_GATEWAYLANG['checkPayment'] . ' <script> window.onload = function(){ setTimeout("location.reload(true);", 2000); } </script>';
|
||||
}
|
||||
} else {
|
||||
if (isset($_POST['start']) || (isset($_GET['a']) && $_GET['a'] == 'complete') || (isset($_GET['action']) && ($_GET['action'] == 'addfunds' || $_GET['action'] == 'masspay') && isset($_POST['paymentmethod']) && $_POST['paymentmethod'] == 'mollie' . $method)) {
|
||||
|
||||
$transactionCurrency = select_query('tblcurrencies', '', array('code' => $params['currency']), null, null, 1);
|
||||
$transactionCurrency = mysql_fetch_assoc($transactionCurrency);
|
||||
|
||||
$transactionId = insert_query('gateway_mollie', array(
|
||||
'amount' => $params['amount'],
|
||||
'currencyid' => $transactionCurrency['id'],
|
||||
'ip' => $_SERVER['REMOTE_ADDR'],
|
||||
'userid' => $params['clientdetails']['userid'],
|
||||
'invoiceid' => $params['invoiceid'],
|
||||
'method' => $method
|
||||
));
|
||||
|
||||
$payment = $mollie->payments->create(array(
|
||||
'amount' => $params['amount'],
|
||||
'method' => $method,
|
||||
'description' => $params['description'],
|
||||
'redirectUrl' => $params['returnurl'] . '&check_payment=' . $transactionId,
|
||||
'webhookUrl' => $params['systemurl'] . '/modules/gateways/mollie/callback.php',
|
||||
'metadata' => array(
|
||||
'invoice_id' => $params['invoiceid'],
|
||||
),
|
||||
'issuer' => ((isset($_POST['issuer']) && !empty($_POST['issuer'])) ? $_POST['issuer'] : NULL)
|
||||
));
|
||||
|
||||
update_query('gateway_mollie', array('paymentid' => $payment->id), array('id' => $transactionId));
|
||||
|
||||
header('Location: ' . $payment->getPaymentUrl());
|
||||
exit();
|
||||
} else {
|
||||
$return = '<form action="" method="POST">';
|
||||
|
||||
if ($method == Mollie_API_Object_Method::IDEAL) {
|
||||
$issuers = $mollie->issuers->all();
|
||||
|
||||
$return .= '<label for="issuer">' . $_GATEWAYLANG['selectBank'] . ':</label> ';
|
||||
|
||||
$return .= '<select name="issuer">';
|
||||
foreach ($issuers as $issuer) {
|
||||
if ($issuer->method == Mollie_API_Object_Method::IDEAL) {
|
||||
$return .= '<option value=' . htmlspecialchars($issuer->id) . '>' . htmlspecialchars($issuer->name) . '</option>';
|
||||
}
|
||||
}
|
||||
$return .= '</select>';
|
||||
}
|
||||
|
||||
$return .= '<input type="submit" name="start" value="' . $_GATEWAYLANG['payWith' . ucfirst($method)] . '" /></form>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
||||
68
mollie/vendor/Mollie/API/Autoloader.php
vendored
Normal file
68
mollie/vendor/Mollie/API/Autoloader.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Autoloader
|
||||
{
|
||||
/**
|
||||
* @param string $class_name
|
||||
*/
|
||||
public static function autoload ($class_name)
|
||||
{
|
||||
if (strpos($class_name, "Mollie_") === 0)
|
||||
{
|
||||
$file_name = str_replace("_", "/", $class_name);
|
||||
$file_name = realpath(dirname(__FILE__) . "/../../{$file_name}.php");
|
||||
|
||||
if ($file_name !== false)
|
||||
{
|
||||
require $file_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function register ()
|
||||
{
|
||||
return spl_autoload_register(array(__CLASS__, "autoload"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function unregister ()
|
||||
{
|
||||
return spl_autoload_unregister(array(__CLASS__, "autoload"));
|
||||
}
|
||||
}
|
||||
|
||||
Mollie_API_Autoloader::register();
|
||||
306
mollie/vendor/Mollie/API/Client.php
vendored
Normal file
306
mollie/vendor/Mollie/API/Client.php
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Client
|
||||
{
|
||||
/**
|
||||
* Version of our client.
|
||||
*/
|
||||
const CLIENT_VERSION = "1.2.10";
|
||||
|
||||
/**
|
||||
* Endpoint of the remote API.
|
||||
*/
|
||||
const API_ENDPOINT = "https://api.mollie.nl";
|
||||
|
||||
/**
|
||||
* Version of the remote API.
|
||||
*/
|
||||
const API_VERSION = "v1";
|
||||
|
||||
const HTTP_GET = "GET";
|
||||
const HTTP_POST = "POST";
|
||||
const HTTP_DELETE = "DELETE";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $api_endpoint = self::API_ENDPOINT;
|
||||
|
||||
/**
|
||||
* RESTful Payments resource.
|
||||
*
|
||||
* @var Mollie_API_Resource_Payments
|
||||
*/
|
||||
public $payments;
|
||||
|
||||
/**
|
||||
* RESTful Payments Refunds resource.
|
||||
*
|
||||
* @var Mollie_API_Resource_Payments_Refunds
|
||||
*/
|
||||
public $payments_refunds;
|
||||
|
||||
/**
|
||||
* RESTful Issuers resource.
|
||||
*
|
||||
* @var Mollie_API_Resource_Issuers
|
||||
*/
|
||||
public $issuers;
|
||||
|
||||
/**
|
||||
* RESTful Methods resource.
|
||||
*
|
||||
* @var Mollie_API_Resource_Methods
|
||||
*/
|
||||
public $methods;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $api_key;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $version_strings = array();
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $ch;
|
||||
|
||||
/**
|
||||
* @throws Mollie_API_Exception_IncompatiblePlatform
|
||||
*/
|
||||
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);
|
||||
|
||||
$curl_version = curl_version();
|
||||
|
||||
$this->addVersionString("Mollie/" . self::CLIENT_VERSION);
|
||||
$this->addVersionString("PHP/" . phpversion());
|
||||
$this->addVersionString("cURL/" . $curl_version["version"]);
|
||||
$this->addVersionString($curl_version["ssl_version"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*/
|
||||
public function setApiEndpoint ($url)
|
||||
{
|
||||
$this->api_endpoint = rtrim(trim($url), '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiEndpoint ()
|
||||
{
|
||||
return $this->api_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $api_key The Mollie API key, starting with 'test_' or 'live_'
|
||||
* @throws Mollie_API_Exception
|
||||
*/
|
||||
public function setApiKey ($api_key)
|
||||
{
|
||||
$api_key = trim($api_key);
|
||||
|
||||
if (!preg_match('/^(live|test)_\w+$/', $api_key))
|
||||
{
|
||||
throw new Mollie_API_Exception("Invalid API key: '{$api_key}'. An API key must start with 'test_' or 'live_'.");
|
||||
}
|
||||
|
||||
$this->api_key = $api_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version_string
|
||||
*/
|
||||
public function addVersionString ($version_string)
|
||||
{
|
||||
$this->version_strings[] = str_replace(array(" ", "\t", "\n", "\r"), '-', $version_string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an http call. This method is used by the resource specific classes. Please use the $payments property to
|
||||
* perform operations on payments.
|
||||
*
|
||||
* @see $payments
|
||||
* @see $isuers
|
||||
*
|
||||
* @param $http_method
|
||||
* @param $api_method
|
||||
* @param $http_body
|
||||
*
|
||||
* @return string
|
||||
* @throws Mollie_API_Exception
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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.");
|
||||
}
|
||||
|
||||
if (empty($this->ch) || !function_exists("curl_reset"))
|
||||
{
|
||||
/*
|
||||
* Initialize a cURL handle.
|
||||
*/
|
||||
$this->ch = curl_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Reset the earlier used cURL handle.
|
||||
*/
|
||||
curl_reset($this->ch);
|
||||
}
|
||||
|
||||
$url = $this->api_endpoint . "/" . self::API_VERSION . "/" . $api_method;
|
||||
|
||||
curl_setopt($this->ch, CURLOPT_URL, $url);
|
||||
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
curl_setopt($this->ch, CURLOPT_TIMEOUT, 10);
|
||||
|
||||
$user_agent = join(' ', $this->version_strings);
|
||||
|
||||
$request_headers = array(
|
||||
"Accept: application/json",
|
||||
"Authorization: Bearer {$this->api_key}",
|
||||
"User-Agent: {$user_agent}",
|
||||
"X-Mollie-Client-Info: " . php_uname(),
|
||||
);
|
||||
|
||||
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $http_method);
|
||||
|
||||
if ($http_body !== NULL)
|
||||
{
|
||||
$request_headers[] = "Content-Type: application/json";
|
||||
curl_setopt($this->ch, CURLOPT_POST, 1);
|
||||
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $http_body);
|
||||
}
|
||||
|
||||
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $request_headers);
|
||||
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, TRUE);
|
||||
|
||||
/*
|
||||
* 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"));
|
||||
|
||||
$body = curl_exec($this->ch);
|
||||
|
||||
if (curl_errno($this->ch) == CURLE_SSL_CACERT || curl_errno($this->ch) == CURLE_SSL_PEER_CERTIFICATE || curl_errno($this->ch) == 77 /* CURLE_SSL_CACERT_BADFILE (constant not defined in PHP though) */)
|
||||
{
|
||||
if (strpos(curl_error($this->ch), "error setting certificate verify locations") !== FALSE)
|
||||
{
|
||||
/*
|
||||
* Error setting CA-file. Could be missing, or there is a bug in OpenSSL with too long paths.
|
||||
* We give up. Don't do any peer validations.
|
||||
*
|
||||
* @internal #MOL017891004
|
||||
*/
|
||||
array_shift($request_headers);
|
||||
$request_headers[] = "X-Mollie-Debug: unable to use shipped root certificaties, no peer validation.";
|
||||
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
$body = curl_exec($this->ch);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos(curl_error($this->ch), "certificate subject name 'mollie.nl' does not match target host") !== FALSE)
|
||||
{
|
||||
/*
|
||||
* On some servers, the wildcard SSL certificate is not processed correctly. This happens with OpenSSL 0.9.7
|
||||
* from 2003.
|
||||
*/
|
||||
$request_headers[] = "X-Mollie-Debug: old OpenSSL found";
|
||||
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $request_headers);
|
||||
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
$body = curl_exec($this->ch);
|
||||
}
|
||||
|
||||
if (curl_errno($this->ch))
|
||||
{
|
||||
$message = "Unable to communicate with Mollie (".curl_errno($this->ch)."): " . curl_error($this->ch) . ".";
|
||||
|
||||
curl_close($this->ch);
|
||||
$this->ch = NULL;
|
||||
|
||||
throw new Mollie_API_Exception($message);
|
||||
}
|
||||
|
||||
if (!function_exists("curl_reset"))
|
||||
{
|
||||
/*
|
||||
* Keep it open if supported by PHP, else close the handle.
|
||||
*/
|
||||
curl_close($this->ch);
|
||||
$this->ch = NULL;
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close any cURL handles, if we have them.
|
||||
*/
|
||||
public function __destruct ()
|
||||
{
|
||||
if (is_resource($this->ch))
|
||||
{
|
||||
curl_close($this->ch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mollie_API_CompatibilityChecker
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function getCompatibilityChecker ()
|
||||
{
|
||||
return new Mollie_API_CompatibilityChecker();
|
||||
}
|
||||
}
|
||||
158
mollie/vendor/Mollie/API/CompatibilityChecker.php
vendored
Normal file
158
mollie/vendor/Mollie/API/CompatibilityChecker.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_CompatibilityChecker
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public static $MIN_PHP_VERSION = '5.2.0';
|
||||
|
||||
/**
|
||||
* Used cURL functions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $REQUIRED_CURL_FUNCTIONS = array(
|
||||
'curl_init',
|
||||
'curl_setopt',
|
||||
'curl_exec',
|
||||
'curl_error',
|
||||
'curl_errno',
|
||||
'curl_close',
|
||||
'curl_version',
|
||||
);
|
||||
|
||||
/**
|
||||
* @throws Mollie_API_Exception_IncompatiblePlatform
|
||||
* @return void
|
||||
*/
|
||||
public function checkCompatibility ()
|
||||
{
|
||||
if (!$this->satisfiesPhpVersion())
|
||||
{
|
||||
throw new Mollie_API_Exception_IncompatiblePlatform(
|
||||
"The client requires PHP version >= " . self::$MIN_PHP_VERSION . ", you have " . PHP_VERSION . ".",
|
||||
Mollie_API_Exception_IncompatiblePlatform::INCOMPATIBLE_PHP_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->satisfiesJsonExtension())
|
||||
{
|
||||
throw new Mollie_API_Exception_IncompatiblePlatform(
|
||||
"PHP extension json is not enabled. Please make sure to enable 'json' in your PHP configuration.",
|
||||
Mollie_API_Exception_IncompatiblePlatform::INCOMPATIBLE_JSON_EXTENSION
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->satisfiesCurlExtension())
|
||||
{
|
||||
throw new Mollie_API_Exception_IncompatiblePlatform(
|
||||
"PHP extension cURL is not enabled. Please make sure to enable 'curl' in your PHP configuration.",
|
||||
Mollie_API_Exception_IncompatiblePlatform::INCOMPATIBLE_CURL_EXTENSION
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->satisfiesCurlFunctions())
|
||||
{
|
||||
throw new Mollie_API_Exception_IncompatiblePlatform(
|
||||
"This client requires the following cURL functions to be available: " . implode(', ', self::$REQUIRED_CURL_FUNCTIONS) . ". " .
|
||||
"Please check that none of these functions are disabled in your PHP configuration.",
|
||||
Mollie_API_Exception_IncompatiblePlatform::INCOMPATIBLE_CURL_FUNCTION
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function satisfiesPhpVersion ()
|
||||
{
|
||||
return (bool) version_compare(PHP_VERSION, self::$MIN_PHP_VERSION, ">=");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function satisfiesJsonExtension ()
|
||||
{
|
||||
// Check by extension_loaded
|
||||
if (function_exists('extension_loaded') && extension_loaded('json'))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif (function_exists('json_encode'))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function satisfiesCurlExtension ()
|
||||
{
|
||||
// Check by extension_loaded
|
||||
if (function_exists('extension_loaded') && extension_loaded('curl'))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// Check by calling curl_version()
|
||||
elseif (function_exists('curl_version') && curl_version())
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function satisfiesCurlFunctions ()
|
||||
{
|
||||
foreach (self::$REQUIRED_CURL_FUNCTIONS as $curl_function)
|
||||
{
|
||||
if (!function_exists($curl_function))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
54
mollie/vendor/Mollie/API/Exception.php
vendored
Normal file
54
mollie/vendor/Mollie/API/Exception.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Exception extends Exception
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_field;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getField ()
|
||||
{
|
||||
return $this->_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*/
|
||||
public function setField ($field)
|
||||
{
|
||||
$this->_field = (string) $field;
|
||||
}
|
||||
}
|
||||
38
mollie/vendor/Mollie/API/Exception/IncompatiblePlatform.php
vendored
Normal file
38
mollie/vendor/Mollie/API/Exception/IncompatiblePlatform.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Exception_IncompatiblePlatform extends Mollie_API_Exception
|
||||
{
|
||||
const INCOMPATIBLE_PHP_VERSION = 1000;
|
||||
const INCOMPATIBLE_CURL_EXTENSION = 2000;
|
||||
const INCOMPATIBLE_CURL_FUNCTION = 2500;
|
||||
const INCOMPATIBLE_JSON_EXTENSION = 3000;
|
||||
}
|
||||
55
mollie/vendor/Mollie/API/Object/Issuer.php
vendored
Normal file
55
mollie/vendor/Mollie/API/Object/Issuer.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Object_Issuer
|
||||
{
|
||||
/**
|
||||
* Id of the issuer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Name of the issuer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The payment method this issuer belongs to.
|
||||
*
|
||||
* @see Mollie_API_Object_Method
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
}
|
||||
54
mollie/vendor/Mollie/API/Object/List.php
vendored
Normal file
54
mollie/vendor/Mollie/API/Object/List.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Object_List extends ArrayObject
|
||||
{
|
||||
/**
|
||||
* Total number of available objects on the Mollie platform.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $totalCount;
|
||||
|
||||
/**
|
||||
* Numeric offset from which this list of object was created.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $offset;
|
||||
|
||||
/**
|
||||
* Total number of retrieved objects.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $count;
|
||||
}
|
||||
137
mollie/vendor/Mollie/API/Object/Method.php
vendored
Normal file
137
mollie/vendor/Mollie/API/Object/Method.php
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Object_Method
|
||||
{
|
||||
/**
|
||||
* @link https://mollie.com/ideal
|
||||
*/
|
||||
const IDEAL = "ideal";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/paysafecard
|
||||
*/
|
||||
const PAYSAFECARD = "paysafecard";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/creditcard
|
||||
*/
|
||||
const CREDITCARD = "creditcard";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/mistercash
|
||||
*/
|
||||
const MISTERCASH = "mistercash";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/sofort
|
||||
*/
|
||||
const SOFORT = "sofort";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/banktransfer
|
||||
*/
|
||||
const BANKTRANSFER = "banktransfer";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/directdebit
|
||||
*/
|
||||
const DIRECTDEBIT = "directdebit";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/paypal
|
||||
*/
|
||||
const PAYPAL = "paypal";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/bitcoin
|
||||
*/
|
||||
const BITCOIN = "bitcoin";
|
||||
|
||||
/**
|
||||
* @link https://mollie.com/belfiusdirectnet
|
||||
*/
|
||||
const BELFIUS = "belfius";
|
||||
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* More legible description of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* The $amount->minimum and $amount->maximum supported by this method and the used API key.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* The $image->normal and $image->bigger to display the payment method logo.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $image;
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getMinimumAmount ()
|
||||
{
|
||||
if (empty($this->amount))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (float) $this->amount->minimum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getMaximumAmount ()
|
||||
{
|
||||
if (empty($this->amount))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (float) $this->amount->maximum;
|
||||
}
|
||||
}
|
||||
345
mollie/vendor/Mollie/API/Object/Payment.php
vendored
Normal file
345
mollie/vendor/Mollie/API/Object/Payment.php
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Object_Payment
|
||||
{
|
||||
/**
|
||||
* The payment has just been created, no action has happened on it yet.
|
||||
*/
|
||||
const STATUS_OPEN = "open";
|
||||
|
||||
/**
|
||||
* The payment has just been started, no final confirmation yet.
|
||||
*/
|
||||
const STATUS_PENDING = "pending";
|
||||
|
||||
/**
|
||||
* The customer has cancelled the payment.
|
||||
*/
|
||||
const STATUS_CANCELLED = "cancelled";
|
||||
|
||||
/**
|
||||
* The payment has expired due to inaction of the customer.
|
||||
*/
|
||||
const STATUS_EXPIRED = "expired";
|
||||
|
||||
/**
|
||||
* The payment has been paid.
|
||||
*/
|
||||
const STATUS_PAID = "paid";
|
||||
|
||||
/**
|
||||
* The payment has been paidout and the money has been transferred to the bank account of the merchant.
|
||||
*/
|
||||
const STATUS_PAIDOUT = "paidout";
|
||||
|
||||
/**
|
||||
* The payment has been refunded, either through Mollie or through the payment provider (in the case of PayPal).
|
||||
*/
|
||||
const STATUS_REFUNDED = "refunded";
|
||||
|
||||
/**
|
||||
* Some payment methods provide your customers with the ability to dispute payments which could
|
||||
* ultimately lead to a chargeback.
|
||||
*/
|
||||
const STATUS_CHARGED_BACK = "charged_back";
|
||||
|
||||
/**
|
||||
* Id of the payment (on the Mollie platform).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Mode of the payment, either "live" or "test" depending on the API Key that was used.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* The amount of the payment in EURO with 2 decimals.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* The amount of the payment that has been refunded to the consumer, in EURO with 2 decimals. This field will be
|
||||
* NULL if the payment can not be refunded.
|
||||
*
|
||||
* @var float|null
|
||||
*/
|
||||
public $amountRefunded;
|
||||
|
||||
/**
|
||||
* The amount of a refunded payment that can still be refunded, in EURO with 2 decimals. This field will be
|
||||
* NULL if the payment can not be refunded.
|
||||
*
|
||||
* For some payment methods this amount can be higher than the payment amount. This is possible to reimburse
|
||||
* the costs for a return shipment to your customer for example.
|
||||
*
|
||||
* @var float|null
|
||||
*/
|
||||
public $amountRemaining;
|
||||
|
||||
/**
|
||||
* Description of the payment that is shown to the customer during the payment, and
|
||||
* possibly on the bank or credit card statement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* If method is empty/null, the customer can pick his/her preferred payment method.
|
||||
*
|
||||
* @see Mollie_API_Object_Method
|
||||
* @var string|null
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* The status of the payment.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status = self::STATUS_OPEN;
|
||||
|
||||
/**
|
||||
* The period after which the payment will expire in ISO-8601 format.
|
||||
*
|
||||
* @example P12DT11H30M45S (12 days, 11 hours, 30 minutes and 45 seconds)
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiryPeriod;
|
||||
|
||||
/**
|
||||
* Date and time the payment was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54.0Z"
|
||||
* @var string|null
|
||||
*/
|
||||
public $createdDatetime;
|
||||
|
||||
/**
|
||||
* Date and time the payment was paid in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $paidDatetime;
|
||||
|
||||
/**
|
||||
* Date and time the payment was cancelled in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $cancelledDatetime;
|
||||
|
||||
/**
|
||||
* Date and time the payment was cancelled in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiredDatetime;
|
||||
|
||||
/**
|
||||
* The profile ID this payment belongs to.
|
||||
*
|
||||
* @example pfl_xH2kP6Nc6X
|
||||
* @var string
|
||||
*/
|
||||
public $profileId;
|
||||
|
||||
/**
|
||||
* The locale used for this payment.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* During creation of the payment you can set custom metadata that is stored with
|
||||
* the payment, and given back whenever you retrieve that payment.
|
||||
*
|
||||
* @var object|mixed|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* Details of a successfully paid payment are set here. For example, the iDEAL
|
||||
* payment method will set $details->consumerName and $details->consumerAccount.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $details;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $links;
|
||||
|
||||
|
||||
/**
|
||||
* Is this payment cancelled?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCancelled ()
|
||||
{
|
||||
return $this->status == self::STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is this payment expired?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isExpired ()
|
||||
{
|
||||
return $this->status == self::STATUS_EXPIRED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is this payment still open / ongoing?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOpen ()
|
||||
{
|
||||
return $this->status == self::STATUS_OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment pending?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending ()
|
||||
{
|
||||
return $this->status == self::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment paid for?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid ()
|
||||
{
|
||||
return !empty($this->paidDatetime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment (partially) refunded?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRefunded ()
|
||||
{
|
||||
return $this->status == self::STATUS_REFUNDED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment charged back?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isChargedBack ()
|
||||
{
|
||||
return $this->status == self::STATUS_CHARGED_BACK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment URL where the customer can complete the payment.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaymentUrl ()
|
||||
{
|
||||
if (empty($this->links->paymentUrl))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return $this->links->paymentUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canBeRefunded ()
|
||||
{
|
||||
return $this->amountRemaining !== NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canBePartiallyRefunded ()
|
||||
{
|
||||
return $this->canBeRefunded() && $this->method !== Mollie_API_Object_Method::CREDITCARD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount that is already refunded
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountRefunded ()
|
||||
{
|
||||
if ($this->amountRefunded)
|
||||
{
|
||||
return floatval($this->amountRefunded);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the remaining amount that can be refunded. For some payment methods this amount can be higher than
|
||||
* the payment amount. This is possible to reimburse the costs for a return shipment to your customer for example.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountRemaining ()
|
||||
{
|
||||
if ($this->amountRemaining)
|
||||
{
|
||||
return floatval($this->amountRemaining);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
113
mollie/vendor/Mollie/API/Object/Payment/Refund.php
vendored
Normal file
113
mollie/vendor/Mollie/API/Object/Payment/Refund.php
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
class Mollie_API_Object_Payment_Refund
|
||||
{
|
||||
/**
|
||||
* The refund will be send to the bank on the next business day. You can still cancel the refund.
|
||||
*/
|
||||
const STATUS_PENDING = 'pending';
|
||||
|
||||
/**
|
||||
* The refund has been sent to the bank. The refund amount will be transferred to the consumer account as soon as possible.
|
||||
*/
|
||||
const STATUS_PROCESSING = 'processing';
|
||||
|
||||
/**
|
||||
* The refund amount has been transferred to the consumer.
|
||||
*/
|
||||
const STATUS_REFUNDED = 'refunded';
|
||||
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The $amount that was refunded.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* The payment that was refunded.
|
||||
*
|
||||
* @var Mollie_API_Object_Payment
|
||||
*/
|
||||
public $payment;
|
||||
|
||||
/**
|
||||
* Date and time the payment was cancelled in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $refundedDatetime;
|
||||
|
||||
/**
|
||||
* The refund status
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Is this refund pending?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending ()
|
||||
{
|
||||
return $this->status == self::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund processing?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isProcessing ()
|
||||
{
|
||||
return $this->status == self::STATUS_PROCESSING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund transferred to consumer?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransferred ()
|
||||
{
|
||||
return $this->status == self::STATUS_REFUNDED;
|
||||
}
|
||||
}
|
||||
250
mollie/vendor/Mollie/API/Resource/Base.php
vendored
Normal file
250
mollie/vendor/Mollie/API/Resource/Base.php
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*/
|
||||
abstract class Mollie_API_Resource_Base
|
||||
{
|
||||
const REST_CREATE = Mollie_API_Client::HTTP_POST;
|
||||
const REST_UPDATE = Mollie_API_Client::HTTP_POST;
|
||||
const REST_READ = Mollie_API_Client::HTTP_GET;
|
||||
const REST_LIST = Mollie_API_Client::HTTP_GET;
|
||||
const REST_DELETE = Mollie_API_Client::HTTP_DELETE;
|
||||
|
||||
/**
|
||||
* Default number of objects to retrieve when listing all objects.
|
||||
*/
|
||||
const DEFAULT_LIMIT = 50;
|
||||
|
||||
/**
|
||||
* @var Mollie_API_Client
|
||||
*/
|
||||
protected $api;
|
||||
|
||||
/**
|
||||
* @param Mollie_API_Client $api
|
||||
*/
|
||||
public function __construct(Mollie_API_Client $api)
|
||||
{
|
||||
$this->api = $api;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getResourceName ()
|
||||
{
|
||||
$class_parts = explode("_", get_class($this));
|
||||
|
||||
return strtolower(end($class_parts));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $rest_resource
|
||||
* @param $body
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
private function rest_create($rest_resource, $body)
|
||||
{
|
||||
$result = $this->performApiCall(self::REST_CREATE, $rest_resource, $body);
|
||||
return $this->copy($result, $this->getResourceObject($rest_resource));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a single object from the REST API.
|
||||
*
|
||||
* @param string $rest_resource Resource name.
|
||||
* @param string $id Id of the object to retrieve.
|
||||
* @throws Mollie_API_Exception
|
||||
* @return object
|
||||
*/
|
||||
private function rest_read ($rest_resource, $id)
|
||||
{
|
||||
if (empty($id))
|
||||
{
|
||||
throw new Mollie_API_Exception("Invalid resource id.");
|
||||
}
|
||||
|
||||
$id = urlencode($id);
|
||||
$result = $this->performApiCall(self::REST_READ, "{$rest_resource}/{$id}");
|
||||
|
||||
return $this->copy($result, $this->getResourceObject($rest_resource));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a collection of objects from the REST API.
|
||||
*
|
||||
* @param $rest_resource
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @param array $options
|
||||
*
|
||||
* @return Mollie_API_Object_List
|
||||
*/
|
||||
private function rest_list($rest_resource, $offset = 0, $limit = self::DEFAULT_LIMIT, array $options = array())
|
||||
{
|
||||
$options = array_merge(array("offset" => $offset, "count" => $limit), $options);
|
||||
|
||||
$api_path = $rest_resource . "?" . http_build_query($options, "", "&"); /* Force & because of some PHP 5.3 defaults */
|
||||
|
||||
$result = $this->performApiCall(self::REST_LIST, $api_path);
|
||||
|
||||
/** @var Mollie_API_Object_List $collection */
|
||||
$collection = $this->copy($result, new Mollie_API_Object_List);
|
||||
|
||||
foreach ($result->data as $data_result)
|
||||
{
|
||||
$collection[] = $this->copy($data_result, $this->getResourceObject());
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the results received from the API into the PHP objects that we use.
|
||||
*
|
||||
* @param object $api_result
|
||||
* @param object $object
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function copy($api_result, $object)
|
||||
{
|
||||
foreach ($api_result as $property => $value)
|
||||
{
|
||||
if (property_exists(get_class($object), $property))
|
||||
{
|
||||
$object->$property = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object that is used by this API. Every API uses one type of object.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
abstract protected function getResourceObject();
|
||||
|
||||
/**
|
||||
* Create a resource with the remote API.
|
||||
*
|
||||
* @param array $data An array containing details on the resource. Fields supported depend on the resource created.
|
||||
*
|
||||
* @throws Mollie_API_Exception
|
||||
* @return object
|
||||
*/
|
||||
public function create(array $data = array())
|
||||
{
|
||||
$encoded = json_encode($data);
|
||||
|
||||
if (version_compare(phpversion(), "5.3.0", ">="))
|
||||
{
|
||||
if (json_last_error() != JSON_ERROR_NONE)
|
||||
{
|
||||
throw new Mollie_API_Exception("Error encoding parameters into JSON: '" . json_last_error() . "'.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($encoded === FALSE)
|
||||
{
|
||||
throw new Mollie_API_Exception("Error encoding parameters into JSON.");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->rest_create($this->getResourceName(), $encoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve information on a single resource from Mollie.
|
||||
*
|
||||
* Will throw a Mollie_API_Exception if the resource cannot be found.
|
||||
*
|
||||
* @param string $resource_id
|
||||
*
|
||||
* @throws Mollie_API_Exception
|
||||
* @return object
|
||||
*/
|
||||
public function get($resource_id)
|
||||
{
|
||||
return $this->rest_read($this->getResourceName(), $resource_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all objects of a certain resource.
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @param array $options
|
||||
*
|
||||
* @return Mollie_API_Object_List
|
||||
*/
|
||||
public function all ($offset = 0, $limit = 0, array $options = array())
|
||||
{
|
||||
return $this->rest_list($this->getResourceName(), $offset, $limit, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an API call, and interpret the results and convert them to correct objects.
|
||||
*
|
||||
* @param $http_method
|
||||
* @param $api_method
|
||||
* @param null $http_body
|
||||
*
|
||||
* @return object
|
||||
* @throws Mollie_API_Exception
|
||||
*/
|
||||
protected function performApiCall($http_method, $api_method, $http_body = NULL)
|
||||
{
|
||||
$body = $this->api->performHttpCall($http_method, $api_method, $http_body);
|
||||
|
||||
if (!($object = @json_decode($body)))
|
||||
{
|
||||
throw new Mollie_API_Exception("Unable to decode Mollie response: '{$body}'.");
|
||||
}
|
||||
|
||||
if (!empty($object->error))
|
||||
{
|
||||
$exception = new Mollie_API_Exception("Error executing API call ({$object->error->type}): {$object->error->message}.");
|
||||
|
||||
if (!empty($object->error->field))
|
||||
{
|
||||
$exception->setField($object->error->field);
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
44
mollie/vendor/Mollie/API/Resource/Issuers.php
vendored
Normal file
44
mollie/vendor/Mollie/API/Resource/Issuers.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*
|
||||
* @method Mollie_API_Object_Issuer[]|Mollie_API_Object_List all($offset = 0, $limit = 0)
|
||||
* @method Mollie_API_Object_Issuer get($id)
|
||||
*/
|
||||
class Mollie_API_Resource_Issuers extends Mollie_API_Resource_Base
|
||||
{
|
||||
/**
|
||||
* @return Mollie_API_Object_Issuer
|
||||
*/
|
||||
protected function getResourceObject ()
|
||||
{
|
||||
return new Mollie_API_Object_Issuer;
|
||||
}
|
||||
}
|
||||
44
mollie/vendor/Mollie/API/Resource/Methods.php
vendored
Normal file
44
mollie/vendor/Mollie/API/Resource/Methods.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*
|
||||
* @method Mollie_API_Object_Method[]|Mollie_API_Object_List all($offset = 0, $limit = 0)
|
||||
* @method Mollie_API_Object_Method get($id)
|
||||
*/
|
||||
class Mollie_API_Resource_Methods extends Mollie_API_Resource_Base
|
||||
{
|
||||
/**
|
||||
* @return Mollie_API_Object_Method
|
||||
*/
|
||||
protected function getResourceObject ()
|
||||
{
|
||||
return new Mollie_API_Object_Method;
|
||||
}
|
||||
}
|
||||
102
mollie/vendor/Mollie/API/Resource/Payments.php
vendored
Normal file
102
mollie/vendor/Mollie/API/Resource/Payments.php
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*
|
||||
* @method Mollie_API_Object_Payment[]|Mollie_API_Object_List all($offset = 0, $limit = 0)
|
||||
* @method Mollie_API_Object_Payment create(array $data)
|
||||
*/
|
||||
class Mollie_API_Resource_Payments extends Mollie_API_Resource_Base
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const RESOURCE_ID_PREFIX = 'tr_';
|
||||
|
||||
/**
|
||||
* @return Mollie_API_Object_Payment
|
||||
*/
|
||||
protected function getResourceObject ()
|
||||
{
|
||||
return new Mollie_API_Object_Payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single payment from Mollie.
|
||||
*
|
||||
* Will throw a Mollie_API_Exception if the payment id is invalid or the resource cannot be found.
|
||||
*
|
||||
* @param string $payment_id
|
||||
*
|
||||
* @throws Mollie_API_Exception
|
||||
* @return Mollie_API_Object_Payment
|
||||
*/
|
||||
public function get($payment_id)
|
||||
{
|
||||
if (empty($payment_id) || strpos($payment_id, self::RESOURCE_ID_PREFIX) !== 0)
|
||||
{
|
||||
throw new Mollie_API_Exception("Invalid payment ID: '{$payment_id}'. A payment ID should start with '" . self::RESOURCE_ID_PREFIX . "'.");
|
||||
}
|
||||
|
||||
return parent::get($payment_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Mollie_API_Object_Payment $payment
|
||||
* @param float|NULL $amount Amount to refund, or NULL to refund full amount.
|
||||
* @return Mollie_API_Object_Payment_Refund
|
||||
*/
|
||||
public function refund (Mollie_API_Object_Payment $payment, $amount = NULL)
|
||||
{
|
||||
$resource = "{$this->getResourceName()}/" . urlencode($payment->id) . "/refunds";
|
||||
|
||||
$body = NULL;
|
||||
if ($amount)
|
||||
{
|
||||
$body = json_encode(
|
||||
array("amount" => $amount)
|
||||
);
|
||||
}
|
||||
|
||||
$result = $this->performApiCall(self::REST_CREATE, $resource, $body);
|
||||
|
||||
/*
|
||||
* Update the payment with the new properties that we got from the refund.
|
||||
*/
|
||||
if (!empty($result->payment))
|
||||
{
|
||||
foreach ($result->payment as $payment_key => $payment_value)
|
||||
{
|
||||
$payment->{$payment_key} = $payment_value;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->copy($result, new Mollie_API_Object_Payment_Refund);
|
||||
}
|
||||
}
|
||||
69
mollie/vendor/Mollie/API/Resource/Payments/Refunds.php
vendored
Normal file
69
mollie/vendor/Mollie/API/Resource/Payments/Refunds.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, 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. <info@mollie.com>
|
||||
* @copyright Mollie B.V.
|
||||
* @link https://www.mollie.com
|
||||
*
|
||||
* @method Mollie_API_Object_Payment_Refund[]|Mollie_API_Object_List all($offset = 0, $limit = 0)
|
||||
* @method Mollie_API_Object_Payment_Refund get($resource_id)
|
||||
*/
|
||||
class Mollie_API_Resource_Payments_Refunds extends Mollie_API_Resource_Base
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $payment_id;
|
||||
|
||||
/**
|
||||
* @return Mollie_API_Object_Method
|
||||
*/
|
||||
protected function getResourceObject ()
|
||||
{
|
||||
return new Mollie_API_Object_Payment_Refund;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getResourceName ()
|
||||
{
|
||||
return "payments/" . urlencode($this->payment_id) . "/refunds";
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the resource to use a certain payment. Use this method before performing a get() or all() call.
|
||||
*
|
||||
* @param Mollie_API_Object_Payment $payment
|
||||
* @return self
|
||||
*/
|
||||
public function with(Mollie_API_Object_Payment $payment)
|
||||
{
|
||||
$this->payment_id = $payment->id;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
3860
mollie/vendor/Mollie/API/cacert.pem
vendored
Normal file
3860
mollie/vendor/Mollie/API/cacert.pem
vendored
Normal file
File diff suppressed because it is too large
Load Diff
20
molliebanktransfer.php
Executable file
20
molliebanktransfer.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliebanktransfer_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Bank Transfer'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliebanktransfer_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::BANKTRANSFER);
|
||||
}
|
||||
20
molliebelfius.php
Executable file
20
molliebelfius.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliebelfius_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Belfius'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliebelfius_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::BELFIUS);
|
||||
}
|
||||
20
molliebitcoin.php
Executable file
20
molliebitcoin.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliebitcoin_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Bitcoin'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliebitcoin_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::BITCOIN);
|
||||
}
|
||||
20
molliedirectdebit.php
Executable file
20
molliedirectdebit.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliedirectdebit_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Direct Debit'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliedirectdebit_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::DIRECTDEBIT);
|
||||
}
|
||||
20
mollieideal.php
Executable file
20
mollieideal.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function mollieideal_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie iDeal'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function mollieideal_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::IDEAL);
|
||||
}
|
||||
20
molliemistercash.php
Executable file
20
molliemistercash.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliemistercash_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Mistercash'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliemistercash_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::MISTERCASH);
|
||||
}
|
||||
20
molliepaypal.php
Executable file
20
molliepaypal.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliepaypal_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie PayPal'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliepaypal_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::PAYPAL);
|
||||
}
|
||||
20
molliepaysafecard.php
Executable file
20
molliepaysafecard.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliepaysafecard_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Paysafecard'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliepaysafecard_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::PAYSAFECARD);
|
||||
}
|
||||
20
molliesofort.php
Executable file
20
molliesofort.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'mollie/mollie.php';
|
||||
|
||||
function molliesofort_config() {
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value'=> 'Mollie Sofort Banking'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function molliesofort_link($params) {
|
||||
return mollie_link($params, Mollie_API_Object_Method::SOFORT);
|
||||
}
|
||||
Reference in New Issue
Block a user