-
Notifications
You must be signed in to change notification settings - Fork 1
/
SetefiGatewayFactory.php
57 lines (50 loc) · 1.97 KB
/
SetefiGatewayFactory.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
<?php
namespace Webburza\Payum\Setefi;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayFactory;
use Webburza\Payum\Setefi\Action\NotifyAction;
use Webburza\Payum\Setefi\Action\CaptureAction;
use Webburza\Payum\Setefi\Action\CancelAction;
use Webburza\Payum\Setefi\Action\ConvertPaymentAction;
use Webburza\Payum\Setefi\Action\CreateTransactionAction;
use Webburza\Payum\Setefi\Action\RefundAction;
use Webburza\Payum\Setefi\Action\StatusAction;
/**
* Class SetefiGatewayFactory.
*/
class SetefiGatewayFactory extends GatewayFactory
{
/**
* {@inheritdoc}
*
* @throws \Payum\Core\Exception\InvalidArgumentException
* @throws \Payum\Core\Exception\LogicException
*/
protected function populateConfig(ArrayObject $config)
{
$config->defaults(
[
'payum.factory_name' => 'setefi',
'payum.factory_title' => 'Setefi',
'payum.action.capture' => new CaptureAction(),
'payum.action.notify' => new NotifyAction(),
'payum.action.refund' => new RefundAction(),
'payum.action.cancel' => new CancelAction(),
'payum.action.status' => new StatusAction(),
'payum.action.convert_payment' => new ConvertPaymentAction(),
'payum.action.api.create_transaction' => new CreateTransactionAction(),
]
);
if (null === $config['payum.api']) {
$config['payum.default_options'] = [
'sandbox' => true,
];
$config->defaults($config['payum.default_options']);
$config['payum.required_options'] = ['terminal_id', 'terminal_password', 'sandbox'];
$config['payum.api'] = function (ArrayObject $config) {
$config->validatedKeysSet($config['payum.required_options']);
return new Api((array) $config, $config['payum.http_client'], $config['httplug.message_factory']);
};
}
}
}