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