-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostfinanceEcommerceGatewayFactory.php
49 lines (43 loc) · 1.85 KB
/
PostfinanceEcommerceGatewayFactory.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 Payum\PostfinanceEcommerce;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayFactory;
use Payum\PostfinanceEcommerce\Action\CaptureAction;
use Payum\PostfinanceEcommerce\Action\NotifyAction;
use Payum\PostfinanceEcommerce\Action\NotifyNullAction;
use Payum\PostfinanceEcommerce\Action\StatusAction;
class PostfinanceEcommerceGatewayFactory extends GatewayFactory
{
/**
* {@inheritdoc}
*/
protected function populateConfig(ArrayObject $config)
{
$config->defaults(array(
'payum.factory_name' => 'postfinance_ecommerce',
'payum.factory_title' => 'Postfinance Ecommerce',
'payum.action.capture' => new CaptureAction(),
'payum.action.status' => new StatusAction(),
'payum.action.notify_null' => new NotifyNullAction(),
'payum.action.notify' => new NotifyAction(),
));
if (false == $config['payum.api']) {
$config['payum.default_options'] = [
'environment' => Api::TEST
];
$config->defaults($config['payum.default_options']);
$config['payum.required_options'] = ['sha-in-passphrase', 'sha-out-passphrase', 'pspid'];
$config['payum.api'] = function (ArrayObject $config) {
$config->validateNotEmpty($config['payum.required_options']);
$postfinanceConfig = [
'sha-in-passphrase' => $config['sha-in-passphrase'],
'sha-out-passphrase' => $config['sha-out-passphrase'],
'pspid' => $config['pspid'],
'environment' => $config['environment'],
'default_parameters' => isset($config['default_parameters']) ? $config['default_parameters'] : []
];
return new Api($postfinanceConfig);
};
}
}
}