mirror of
https://github.com/0100Dev/WHMCS-Mollie-Payments.git
synced 2026-01-18 03:28:18 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12f9d4fa18 | |||
| 60b8d2b62c | |||
|
|
bf67c41604 | ||
|
|
4e3fc4f1cb | ||
|
|
f3378c5181 | ||
|
|
b70fec170f | ||
|
|
f107379191 | ||
|
|
e5b27108f7 |
171
composer.lock
generated
171
composer.lock
generated
@@ -8,27 +8,27 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/ca-bundle",
|
||||
"version": "1.1.4",
|
||||
"version": "1.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/ca-bundle.git",
|
||||
"reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d"
|
||||
"reference": "8a7ecad675253e4654ea05505233285377405215"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/558f321c52faeb4828c03e7dc0cfe39a09e09a2d",
|
||||
"reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d",
|
||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215",
|
||||
"reference": "8a7ecad675253e4654ea05505233285377405215",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-openssl": "*",
|
||||
"ext-pcre": "*",
|
||||
"php": "^5.3.2 || ^7.0"
|
||||
"php": "^5.3.2 || ^7.0 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
|
||||
"psr/log": "^1.0",
|
||||
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
||||
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -60,48 +60,56 @@
|
||||
"ssl",
|
||||
"tls"
|
||||
],
|
||||
"time": "2019-01-28T09:30:10+00:00"
|
||||
"time": "2020-08-23T12:54:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.3.3",
|
||||
"version": "7.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
|
||||
"reference": "7edeaa528fbb57123028bd5a76b9ce9540194e26"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
|
||||
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7edeaa528fbb57123028bd5a76b9ce9540194e26",
|
||||
"reference": "7edeaa528fbb57123028bd5a76b9ce9540194e26",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/promises": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.4",
|
||||
"php": ">=5.5"
|
||||
"guzzlehttp/psr7": "^1.6.1",
|
||||
"php": "^7.2.5",
|
||||
"psr/http-client": "^1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-client-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
|
||||
"psr/log": "^1.0"
|
||||
"php-http/client-integration-tests": "dev-phpunit8",
|
||||
"phpunit/phpunit": "^8.5.5",
|
||||
"psr/log": "^1.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "Required for CURL handler support",
|
||||
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
|
||||
"psr/log": "Required for using the Log middleware"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.3-dev"
|
||||
"dev-master": "7.1-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\": "src/"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
@@ -112,6 +120,11 @@
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com",
|
||||
"homepage": "https://sagikazarmark.hu"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle is a PHP HTTP client library",
|
||||
@@ -122,30 +135,32 @@
|
||||
"framework",
|
||||
"http",
|
||||
"http client",
|
||||
"psr-18",
|
||||
"psr-7",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2018-04-22T15:46:56+00:00"
|
||||
"time": "2020-09-22T09:10:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
"version": "v1.3.1",
|
||||
"version": "1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/promises.git",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
|
||||
"reference": "60d379c243457e073cff02bc323a2a86cb355631"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631",
|
||||
"reference": "60d379c243457e073cff02bc323a2a86cb355631",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0"
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0"
|
||||
"symfony/phpunit-bridge": "^4.4 || ^5.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -176,37 +191,41 @@
|
||||
"keywords": [
|
||||
"promise"
|
||||
],
|
||||
"time": "2016-12-20T10:07:11+00:00"
|
||||
"time": "2020-09-30T07:37:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.5.2",
|
||||
"version": "1.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "9f83dded91781a01c63574e387eaa769be769115"
|
||||
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115",
|
||||
"reference": "9f83dded91781a01c63574e387eaa769be769115",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
||||
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"psr/http-message": "~1.0",
|
||||
"ralouphie/getallheaders": "^2.0.5"
|
||||
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
|
||||
"ext-zlib": "*",
|
||||
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
|
||||
},
|
||||
"suggest": {
|
||||
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.5-dev"
|
||||
"dev-master": "1.7-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -243,20 +262,20 @@
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2018-12-04T20:46:45+00:00"
|
||||
"time": "2020-09-30T07:37:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mollie/mollie-api-php",
|
||||
"version": "v2.10.0",
|
||||
"version": "v2.23.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mollie/mollie-api-php.git",
|
||||
"reference": "151bdb85c325f6768452a3d8461930589be85729"
|
||||
"reference": "bc44a7417a734b92a770213b9f0dc6642e7b5a3c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/151bdb85c325f6768452a3d8461930589be85729",
|
||||
"reference": "151bdb85c325f6768452a3d8461930589be85729",
|
||||
"url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/bc44a7417a734b92a770213b9f0dc6642e7b5a3c",
|
||||
"reference": "bc44a7417a734b92a770213b9f0dc6642e7b5a3c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -264,7 +283,7 @@
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-openssl": "*",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"guzzlehttp/guzzle": "^6.3 || ^7.0",
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -293,6 +312,7 @@
|
||||
"description": "Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.",
|
||||
"homepage": "https://www.mollie.com/en/developers",
|
||||
"keywords": [
|
||||
"Apple Pay",
|
||||
"CBC",
|
||||
"Przelewy24",
|
||||
"api",
|
||||
@@ -328,7 +348,56 @@
|
||||
"sofortbanking",
|
||||
"subscriptions"
|
||||
],
|
||||
"time": "2019-05-20T09:07:29+00:00"
|
||||
"time": "2020-09-17T13:56:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-client",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-client.git",
|
||||
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
|
||||
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.0 || ^8.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Client\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP clients",
|
||||
"homepage": "https://github.com/php-fig/http-client",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-client",
|
||||
"psr",
|
||||
"psr-18"
|
||||
],
|
||||
"time": "2020-06-29T06:28:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
@@ -382,24 +451,24 @@
|
||||
},
|
||||
{
|
||||
"name": "ralouphie/getallheaders",
|
||||
"version": "2.0.5",
|
||||
"version": "3.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ralouphie/getallheaders.git",
|
||||
"reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa"
|
||||
"reference": "120b605dfeb996808c31b6477290a714d356e822"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
|
||||
"reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
|
||||
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
|
||||
"reference": "120b605dfeb996808c31b6477290a714d356e822",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3"
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~3.7.0",
|
||||
"satooshi/php-coveralls": ">=1.0"
|
||||
"php-coveralls/php-coveralls": "^2.1",
|
||||
"phpunit/phpunit": "^5 || ^6.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -418,7 +487,7 @@
|
||||
}
|
||||
],
|
||||
"description": "A polyfill for getallheaders.",
|
||||
"time": "2016-02-11T07:05:27+00:00"
|
||||
"time": "2019-03-08T08:55:37+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
||||
@@ -1,97 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* Setting requirements and includes
|
||||
*
|
||||
*/
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Mollie\Api\MollieApiClient;
|
||||
|
||||
require_once __DIR__ . '/../../../init.php';
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$whmcs->load_function('gateway');
|
||||
$whmcs->load_function('invoice');
|
||||
|
||||
/**
|
||||
*
|
||||
* Check parameters
|
||||
*
|
||||
*/
|
||||
if (isset($_POST['id'])) {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || empty($_POST['id'])) {
|
||||
logTransaction('mollieunknown', $_POST, 'Callback - Failure 0 (Arg mismatch)');
|
||||
http_response_code(500);
|
||||
exit('Arg mismatch');
|
||||
}
|
||||
|
||||
// Get transaction
|
||||
$transactionQuery = select_query('gateway_mollie', '', array('paymentid' => $_POST['id']), null, null, 1);
|
||||
// Find transaction by Mollie payment ID
|
||||
$transaction = Capsule::table('gateway_mollie')
|
||||
->where('paymentid', $_POST['id'])
|
||||
->first();
|
||||
|
||||
if (mysql_num_rows($transactionQuery) != 1) {
|
||||
if (!$transaction) {
|
||||
logTransaction('mollieunknown', $_POST, 'Callback - Failure 2 (Transaction not found)');
|
||||
http_response_code(500);
|
||||
exit('Transaction not found');
|
||||
}
|
||||
|
||||
header('HTTP/1.1 500 Transaction not found');
|
||||
exit();
|
||||
}
|
||||
$transaction = (array) $transaction;
|
||||
$method = $transaction['method'] ?: 'checkout';
|
||||
|
||||
$transaction = mysql_fetch_assoc($transactionQuery);
|
||||
// Load gateway configuration
|
||||
$_GATEWAY = getGatewayVariables('mollie' . $method . '_devapp');
|
||||
|
||||
$method = $transaction['method'];
|
||||
|
||||
if (empty($method)) {
|
||||
$method = 'checkout';
|
||||
}
|
||||
|
||||
$_GATEWAY = getGatewayVariables('mollie' . $method . '_devapp');
|
||||
|
||||
if ($transaction['status'] != 'open') {
|
||||
if ($transaction['status'] !== 'open') {
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 3 (Transaction not open)');
|
||||
http_response_code(500);
|
||||
exit('Transaction not open');
|
||||
}
|
||||
|
||||
header('HTTP/1.1 500 Transaction not open');
|
||||
exit();
|
||||
}
|
||||
// Load currencies
|
||||
$userCurrency = getCurrency($transaction['userid']);
|
||||
$transactionCurrency = Capsule::table('tblcurrencies')
|
||||
->where('id', $transaction['currencyid'])
|
||||
->first();
|
||||
|
||||
// Get user and transaction currencies
|
||||
$userCurrency = getCurrency($transaction['userid']);
|
||||
$transactionCurrency = select_query('tblcurrencies', '', array('id' => $transaction['currencyid']));
|
||||
$transactionCurrency = mysql_fetch_assoc($transactionCurrency);
|
||||
$transactionCurrency = (array) $transactionCurrency;
|
||||
|
||||
// Check payment
|
||||
$mollie = new \Mollie\Api\MollieApiClient();
|
||||
$mollie->setApiKey($_GATEWAY['key']);
|
||||
// Init Mollie
|
||||
$mollie = new MollieApiClient();
|
||||
$mollie->setApiKey($_GATEWAY['key']);
|
||||
|
||||
try {
|
||||
$payment = $mollie->payments->get($_POST['id']);
|
||||
} catch (Exception $e) {
|
||||
logTransaction($_GATEWAY['paymentmethod'], $_POST, 'Callback - Failure 4 (API Error): ' . $e->getMessage());
|
||||
http_response_code(500);
|
||||
exit('Mollie API error');
|
||||
}
|
||||
|
||||
if ($payment->isPaid()) {
|
||||
|
||||
// Add conversion, when there is need to. WHMCS only supports currencies per user. WHY?!
|
||||
// Handle payment status
|
||||
if ($payment->isPaid()) {
|
||||
// Currency conversion if needed
|
||||
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']));
|
||||
Capsule::table('gateway_mollie')
|
||||
->where('id', $transaction['id'])
|
||||
->update(['status' => 'paid', 'updated' => date('Y-m-d H:i:s')]);
|
||||
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Paid)');
|
||||
http_response_code(200);
|
||||
exit('OK');
|
||||
|
||||
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']));
|
||||
} elseif (!$payment->isOpen()) {
|
||||
Capsule::table('gateway_mollie')
|
||||
->where('id', $transaction['id'])
|
||||
->update(['status' => 'closed', 'updated' => date('Y-m-d H:i:s')]);
|
||||
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Closed)');
|
||||
http_response_code(200);
|
||||
exit('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();
|
||||
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 1 (Payment not open or paid)');
|
||||
http_response_code(500);
|
||||
exit('Payment not open or paid');
|
||||
}
|
||||
@@ -41,7 +41,7 @@ function mollie_link($params, $method = Mollie_API_Object_Method::IDEAL)
|
||||
$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;');
|
||||
full_query('CREATE TABLE IF NOT EXISTS `gateway_mollie` (`id` int(11) NOT NULL AUTO_INCREMENT, `paymentid` varchar(40), `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\MollieApiClient();
|
||||
@@ -97,7 +97,7 @@ function mollie_link($params, $method = Mollie_API_Object_Method::IDEAL)
|
||||
'metadata' => array(
|
||||
'invoice_id' => $params['invoiceid'],
|
||||
),
|
||||
'issuer' => ((isset($_POST['issuer']) && !empty($_POST['issuer'])) ? $_POST['issuer'] : NULL)
|
||||
'dueDate' => (($method == \Mollie\Api\Types\PaymentMethod::BANKTRANSFER) ? date('Y-m-d', strtotime('+100 days')) : NULL),
|
||||
));
|
||||
|
||||
update_query('gateway_mollie', array('paymentid' => $payment->id), array('id' => $transactionId));
|
||||
@@ -107,18 +107,6 @@ function mollie_link($params, $method = Mollie_API_Object_Method::IDEAL)
|
||||
} else {
|
||||
$return = '<form action="viewinvoice.php?id=' . $params['invoiceid'] . '" method="POST">';
|
||||
|
||||
if ($method == \Mollie\Api\Types\PaymentMethod::IDEAL) {
|
||||
$issuers = $mollie->methods->get('ideal', ['include' => 'issuers'])->issuers;
|
||||
|
||||
$return .= '<label for="issuer">' . $_GATEWAYLANG['selectBank'] . ':</label> ';
|
||||
|
||||
$return .= '<select name="issuer">';
|
||||
foreach ($issuers as $issuer) {
|
||||
$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;
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/mollie/mollie.php';
|
||||
|
||||
function mollieinghomepay_devapp_config()
|
||||
{
|
||||
$config = mollie_config();
|
||||
|
||||
$config = array_merge($config, array(
|
||||
'FriendlyName' => array(
|
||||
'Type' => 'System',
|
||||
'Value' => 'Mollie ING Home\'Pay'
|
||||
)
|
||||
));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
function mollieinghomepay_devapp_link($params)
|
||||
{
|
||||
return mollie_link($params, \Mollie\Api\Types\PaymentMethod::INGHOMEPAY);
|
||||
}
|
||||
Reference in New Issue
Block a user