-
Notifications
You must be signed in to change notification settings - Fork 1
/
PayseraGatewayFactory.php
49 lines (43 loc) · 1.5 KB
/
PayseraGatewayFactory.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
<?php
namespace PTS\Paysera;
use PTS\Paysera\Action\AuthorizeAction;
use PTS\Paysera\Action\CancelAction;
use PTS\Paysera\Action\ConvertPaymentAction;
use PTS\Paysera\Action\CaptureAction;
use PTS\Paysera\Action\NotifyAction;
use PTS\Paysera\Action\RefundAction;
use PTS\Paysera\Action\StatusAction;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayFactory;
class PayseraGatewayFactory extends GatewayFactory
{
/**
* {@inheritDoc}
*/
protected function populateConfig(ArrayObject $config)
{
$config->defaults([
'payum.factory_name' => 'paysera',
'payum.factory_title' => 'paysera',
'payum.action.capture' => new CaptureAction(),
'payum.action.notify' => new NotifyAction(),
'payum.action.status' => new StatusAction(),
'payum.action.convert_payment' => new ConvertPaymentAction(),
]);
if (false == $config['payum.api']) {
$config['payum.default_options'] = array(
'projectid' => '',
'sign_password' => '',
'test' => true,
);
$config->defaults($config['payum.default_options']);
$config['payum.required_options'] = [
'projectid', 'sign_password'
];
$config['payum.api'] = function (ArrayObject $config) {
$config->validateNotEmpty($config['payum.required_options']);
return new Api((array)$config);
};
}
}
}