Failed Conditions
Push — develop ( 6a6fbf...2eb996 )
by Remco
19:08
created

src/Integration.php (1 issue)

1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\TargetPay;
4
5
use Pronamic\WordPress\Pay\AbstractGatewayIntegration;
0 ignored issues
show
The type Pronamic\WordPress\Pay\AbstractGatewayIntegration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * Title: TargetPay integration
9
 * Description:
10
 * Copyright: 2005-2020 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.3
15
 * @since   1.0.0
16
 */
17
class Integration extends AbstractGatewayIntegration {
18
	/**
19
	 * Construct TargetPay integration.
20
	 *
21
	 * @param array $args Arguments.
22
	 */
23
	public function __construct( $args = array() ) {
24
		$args = wp_parse_args(
25
			$args,
26
			array(
27
				'id'            => 'targetpay-ideal',
28
				'name'          => 'TargetPay - iDEAL',
29
				'product_url'   => \__( 'https://www.targetpay.com/info/ideal?setlang=en', 'pronamic_ideal' ),
30
				'dashboard_url' => 'https://www.targetpay.com/login',
31
				'provider'      => 'targetpay',
32
				'manual_url'    => \__( 'https://www.pronamic.eu/support/how-to-connect-targetpay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ),
33
			)
34
		);
35
36
		parent::__construct( $args );
37
	}
38
39
	/**
40
	 * Get settings fields.
41
	 *
42
	 * @return array
43
	 */
44
	public function get_settings_fields() {
45
		$fields = array();
46
47
		// Intro.
48
		$fields[] = array(
49
			'section' => 'general',
50
			'type'    => 'html',
51
			'html'    => sprintf(
52
				/* translators: 1: TargetPay */
53
				__( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ),
54
				__( 'TargetPay', 'pronamic_ideal' )
55
			),
56
		);
57
58
		// Layout Code.
59
		$fields[] = array(
60
			'section'  => 'general',
61
			'filter'   => FILTER_SANITIZE_STRING,
62
			'meta_key' => '_pronamic_gateway_targetpay_layoutcode',
63
			'title'    => __( 'Layout Code', 'pronamic_ideal' ),
64
			'type'     => 'text',
65
			'tooltip'  => __( 'Layout code as mentioned at <strong>Sub accounts</strong> in the TargetPay dashboard.', 'pronamic_ideal' ),
66
		);
67
68
		return $fields;
69
	}
70
71
	public function get_config( $post_id ) {
72
		$config = new Config();
73
74
		$config->layoutcode = get_post_meta( $post_id, '_pronamic_gateway_targetpay_layoutcode', true );
75
		$config->mode       = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
76
77
		return $config;
78
	}
79
80
	/**
81
	 * Get gateway.
82
	 *
83
	 * @param int $post_id Post ID.
84
	 * @return Gateway
85
	 */
86
	public function get_gateway( $post_id ) {
87
		return new Gateway( $this->get_config( $post_id ) );
88
	}
89
}
90