Conditions | 3 |
Paths | 2 |
Total Lines | 45 |
Code Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | protected function populateConfig(ArrayObject $config) |
||
17 | { |
||
18 | $config->defaults( |
||
19 | [ |
||
20 | 'payum.tcompayway.template.capture' => '@LocasticSyliusHTPayWayPlugin/Offsite/capture.html.twig', |
||
21 | 'payum.factory_name' => self::FACTORY_NAME, |
||
22 | 'payum.factory_title' => 'HT PayWay Offsite', |
||
23 | ] |
||
24 | ); |
||
25 | |||
26 | |||
27 | if (false === (bool)$config['payum.api']) { |
||
28 | $config['payum.default_options'] = [ |
||
29 | 'shop_id' => '', |
||
30 | 'secret_key' => '', |
||
31 | 'authorization_type' => '0', |
||
32 | 'sandbox' => true, |
||
33 | 'disable_installments' => '1', |
||
34 | ]; |
||
35 | |||
36 | $config->defaults($config['payum.default_options']); |
||
37 | $config['payum.required_options'] = [ |
||
38 | 'shop_id', |
||
39 | 'secret_key', |
||
40 | ]; |
||
41 | |||
42 | $config['payum.api'] = function (ArrayObject $config) { |
||
43 | $config->validateNotEmpty($config['payum.required_options']); |
||
44 | |||
45 | $api = new PaymentOffsite( |
||
46 | $config['shop_id'], |
||
47 | $config['secret_key'], |
||
48 | null, |
||
49 | null, |
||
50 | $config['authorization_type'], |
||
51 | null, |
||
52 | null, |
||
53 | $config['sandbox'] |
||
54 | ); |
||
55 | |||
56 | if ($config['disable_installments']) { |
||
57 | $api->setPgwDisableInstallments($config['disable_installments']); |
||
58 | } |
||
59 | |||
60 | return $api; |
||
61 | }; |
||
64 | } |