-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPayoneGatewayFactory.php
executable file
·80 lines (71 loc) · 2.98 KB
/
PayoneGatewayFactory.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* CoreShop.
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2015-2020 Dominik Pfaffenbauer (https://www.pfaffenbauer.at)
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3)
*/
namespace CoreShop\Payum\Payone;
use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\GatewayFactory;
class PayoneGatewayFactory extends GatewayFactory
{
/**
* {@inheritDoc}
*/
protected function populateConfig(ArrayObject $config)
{
$config->defaults([
'payum.factory_name' => 'Payone',
'payum.factory_title' => 'Payone',
'payum.template.credit_card_payment' => '@PayumPayone/Action/credit_card_payment.html.twig',
'payum.action.authorize' => new Action\AuthorizeAction(),
'payum.action.capture' => new Action\CaptureAction(),
'payum.action.convert_payment' => new Action\ConvertPaymentAction(),
'payum.action.notify' => new Action\NotifyAction(),
'payum.action.notify_null' => new Action\NotifyNullAction(),
'payum.action.status' => new Action\StatusAction(),
'payum.action.api.authorize' => new Action\Api\AuthorizeAction(),
'payum.action.api.capture' => new Action\Api\CaptureAction(),
'payum.action.api.pre_authorize' => new Action\Api\PreAuthorizeAction(),
'payum.action.get_pseudo_card_pan' => function (ArrayObject $config) {
return new Action\Api\CreditCardOnSitePayment(
$config['payum.template.credit_card_payment'],
(array)$config
);
},
]);
if (false == $config['payum.api']) {
$config['payum.required_options'] = [
'merchantId',
'portalId',
'accountId',
'key',
'paymentType',
'mode',
];
$config['payum.api'] = function (ArrayObject $config) {
$config->validateNotEmpty($config['payum.required_options']);
return new Api(
[
'merchantId' => $config['merchantId'],
'portalId' => $config['portalId'],
'accountId' => $config['accountId'],
'key' => $config['key'],
'paymentType' => $config['paymentType'],
'mode' => $config['mode'],
],
$config['payum.http_client'],
$config['httplug.message_factory']
);
};
$config['payum.paths'] = array_replace([
'PayumPayone' => __DIR__.'/Resources/views',
], $config['payum.paths'] ?: []);
}
}
}