-
Notifications
You must be signed in to change notification settings - Fork 6
/
Be2BillDirectGatewayFactory.php
48 lines (41 loc) · 1.57 KB
/
Be2BillDirectGatewayFactory.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
<?php
namespace Payum\Be2Bill;
use Payum\Be2Bill\Action\CaptureAction;
use Payum\Be2Bill\Action\ConvertPaymentAction;
use Payum\Be2Bill\Action\StatusAction;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayFactory;
class Be2BillDirectGatewayFactory extends GatewayFactory
{
protected function populateConfig(ArrayObject $config): void
{
$config->defaults([
'payum.factory_name' => 'be2bill_direct',
'payum.factory_title' => 'Be2Bill Direct',
'payum.action.capture' => new CaptureAction(),
'payum.action.status' => new StatusAction(),
'payum.action.convert_payment' => new ConvertPaymentAction(),
]);
if (! $config['payum.api']) {
$config['payum.default_options'] = [
'identifier' => '',
'password' => '',
'sandbox' => true,
];
$config->defaults($config['payum.default_options']);
$config['payum.required_options'] = ['identifier', 'password'];
$config['payum.api'] = function (ArrayObject $config) {
$config->validateNotEmpty($config['payum.required_options']);
return new Api(
[
'identifier' => $config['identifier'],
'password' => $config['password'],
'sandbox' => $config['sandbox'],
],
$config['payum.http_client'],
$config['httplug.message_factory']
);
};
}
}
}