forked from Cloudstek/whmcs-mollie-payment-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mollie.php
111 lines (99 loc) · 2.54 KB
/
mollie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* Mollie Payment Gateway
* @version 1.0.0
*/
if (!defined("WHMCS")) {
die('This file cannot be accessed directly');
}
require_once __DIR__ . '/mollie/vendor/autoload.php';
use Cloudstek\WHMCS\Mollie\AdminStatus as MollieAdminStatus;
use Cloudstek\WHMCS\Mollie\Link as MollieLink;
use Cloudstek\WHMCS\Mollie\Refund as MollieRefund;
/**
* Payment gateway metadata
* @return array
*/
function mollie_MetaData()
{
return array(
'DisplayName' => 'Mollie',
'APIVersion' => '1.1'
);
}
/**
* Payment gateway configuration
* @return array
*/
function mollie_config()
{
global $_LANG;
// Set locale.
putenv('LC_ALL='. $_LANG['locale']);
setlocale(LC_ALL, $_LANG['locale']);
// Text domain.
$textDomain = 'MolliePaymentGateway';
// Bind text domain.
bindtextdomain($textDomain, __DIR__ . '/mollie/lang');
// Visible options.
return array(
'FriendlyName' => array(
'Type' => 'System',
'Value' => 'Mollie'
),
'live_api_key' => array(
'FriendlyName' => dgettext($textDomain, 'Mollie Live API Key'),
'Type' => 'text',
'Size' => '25',
'Description' => dgettext($textDomain, 'Please enter your live API key.')
),
'test_api_key' => array(
'FriendlyName' => dgettext($textDomain, 'Mollie Test API Key'),
'Type' => 'text',
'Size' => '25',
'Description' => dgettext($textDomain, 'Please enter your test API key.')
),
'sandbox' => array(
'FriendlyName' => dgettext($textDomain, 'Sandbox Mode'),
'Type' => 'yesno',
'Size' => '25',
'Description' => dgettext(
$textDomain,
'Enable sandbox mode with test API key. No real transactions will be made.'
)
)
);
}
/**
* Refund transaction
*
* @see mollie/Refund.php
* @param array $params Refund parameters.
* @return array
*/
function mollie_refund(array $params)
{
return (new MollieRefund($params))->run();
}
/**
* Invoice page payment form output
*
* @see mollie/Link.php
* @param array $params Link parameters.
* @return string|null
*/
function mollie_link(array $params)
{
return (new MollieLink($params))->run();
}
/**
* Display admin message
*
* @see mollie/AdminStatus.php
* @param array $params Admin status message parameters.
* @return array|null
*/
function mollie_adminstatusmsg(array $params)
{
return (new MollieAdminStatus($params))->run();
}