1 | <?php |
||
2 | |||
3 | namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3; |
||
4 | |||
5 | use Pronamic\WordPress\Pay\Core\GatewayConfigFactory; |
||
6 | |||
7 | /** |
||
8 | * Title: iDEAL Advanced v3 config factory |
||
9 | * Description: |
||
10 | * Copyright: 2005-2019 Pronamic |
||
11 | * Company: Pronamic |
||
12 | * |
||
13 | * @author Remco Tolsma |
||
14 | * @version 2.0.0 |
||
15 | */ |
||
16 | class ConfigFactory extends GatewayConfigFactory { |
||
17 | private $config_class; |
||
18 | |||
19 | public function __construct( $config_class = 'Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Config', $config_test_class = 'Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Config' ) { |
||
20 | $this->config_class = $config_class; |
||
21 | $this->config_test_class = $config_test_class; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
22 | } |
||
23 | |||
24 | public function get_config( $post_id ) { |
||
25 | $mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
||
26 | |||
27 | $config_class = ( Gateway::MODE_TEST === $mode ) ? $this->config_test_class : $this->config_class; |
||
28 | |||
29 | $config = new $config_class(); |
||
30 | |||
31 | $config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true ); |
||
32 | $config->sub_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_sub_id', true ); |
||
33 | $config->purchase_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_purchase_id', true ); |
||
34 | |||
35 | $config->private_key = get_post_meta( $post_id, '_pronamic_gateway_ideal_private_key', true ); |
||
36 | $config->private_key_password = get_post_meta( $post_id, '_pronamic_gateway_ideal_private_key_password', true ); |
||
37 | $config->private_certificate = get_post_meta( $post_id, '_pronamic_gateway_ideal_private_certificate', true ); |
||
38 | |||
39 | return $config; |
||
40 | } |
||
41 | } |
||
42 |