-
Notifications
You must be signed in to change notification settings - Fork 8
/
SkeletonGatewayFactory.php
45 lines (39 loc) · 1.6 KB
/
SkeletonGatewayFactory.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
<?php
namespace Payum\Skeleton;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayFactory;
use Payum\Skeleton\Action\AuthorizeAction;
use Payum\Skeleton\Action\CancelAction;
use Payum\Skeleton\Action\CaptureAction;
use Payum\Skeleton\Action\ConvertPaymentAction;
use Payum\Skeleton\Action\NotifyAction;
use Payum\Skeleton\Action\RefundAction;
use Payum\Skeleton\Action\StatusAction;
class SkeletonGatewayFactory extends GatewayFactory
{
protected function populateConfig(ArrayObject $config): void
{
$config->defaults([
'payum.factory_name' => 'skeleton',
'payum.factory_title' => 'skeleton',
'payum.action.capture' => new CaptureAction(),
'payum.action.authorize' => new AuthorizeAction(),
'payum.action.refund' => new RefundAction(),
'payum.action.cancel' => new CancelAction(),
'payum.action.notify' => new NotifyAction(),
'payum.action.status' => new StatusAction(),
'payum.action.convert_payment' => new ConvertPaymentAction(),
]);
if (! $config['payum.api']) {
$config['payum.default_options'] = [
'sandbox' => true,
];
$config->defaults($config['payum.default_options']);
$config['payum.required_options'] = [];
$config['payum.api'] = function (ArrayObject $config) {
$config->validateNotEmpty($config['payum.required_options']);
return new Api((array) $config, $config['payum.http_client'], $config['httplug.message_factory']);
};
}
}
}