Failed Conditions
Push — develop ( 81fcae...7dfa2e )
by Remco
04:43
created

src/Integration.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay;
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: MultiSafepay Connect integration
9
 * Description:
10
 * Copyright: 2005-2020 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.5
15
 * @since   1.2.6
16
 */
17
class Integration extends AbstractGatewayIntegration {
18
	/**
19
	 * Construct Mollie iDEAL 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'            => 'multisafepay-connect',
28
				'name'          => 'MultiSafepay - Connect',
29
				'url'           => 'http://www.multisafepay.com/',
30
				'product_url'   => \__( 'http://www.multisafepay.com/', 'pronamic_ideal' ),
31
				'dashboard_url' => 'https://merchant.multisafepay.com/',
32
				'provider'      => 'multisafepay',
33
				'supports'      => array(
34
					'payment_status_request',
35
					'webhook',
36
					'webhook_no_config',
37
				),
38
				'manual_url'    => \__( 'https://www.pronamic.eu/support/how-to-connect-multisafepay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ),
39
			)
40
		);
41
42
		parent::__construct( $args );
43
	}
44
45
	public function get_settings_fields() {
46
		$fields = array();
47
48
		// Account ID
49
		$fields[] = array(
50
			'section'  => 'general',
51
			'filter'   => FILTER_SANITIZE_STRING,
52
			'meta_key' => '_pronamic_gateway_multisafepay_account_id',
53
			'title'    => __( 'Account ID', 'pronamic_ideal' ),
54
			'type'     => 'text',
55
			'classes'  => array( 'code' ),
56
			'tooltip'  => sprintf(
57
				'%s %s.',
58
				__( 'Account ID', 'pronamic_ideal' ),
59
				/* translators: %s: MultiSafepay */
60
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
61
			),
62
		);
63
64
		// Site ID
65
		$fields[] = array(
66
			'section'  => 'general',
67
			'filter'   => FILTER_SANITIZE_STRING,
68
			'meta_key' => '_pronamic_gateway_multisafepay_site_id',
69
			'title'    => __( 'Site ID', 'pronamic_ideal' ),
70
			'type'     => 'text',
71
			'classes'  => array( 'code' ),
72
			'tooltip'  => sprintf(
73
				'%s %s.',
74
				__( 'Site ID', 'pronamic_ideal' ),
75
				/* translators: %s: MultiSafepay */
76
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
77
			),
78
		);
79
80
		// Site Security Code
81
		$fields[] = array(
82
			'section'  => 'general',
83
			'filter'   => FILTER_SANITIZE_STRING,
84
			'meta_key' => '_pronamic_gateway_multisafepay_site_code',
85
			'title'    => __( 'Site Security Code', 'pronamic_ideal' ),
86
			'type'     => 'text',
87
			'classes'  => array( 'code' ),
88
			'tooltip'  => sprintf(
89
				'%s %s.',
90
				__( 'Site Security Code', 'pronamic_ideal' ),
91
				/* translators: %s: MultiSafepay */
92
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
93
			),
94
		);
95
96
		return $fields;
97
	}
98
99
	/**
100
	 * Get config.
101
	 *
102
	 * @param $post_id
103
	 *
104
	 * @return Config
105
	 */
106
	public function get_config( $post_id ) {
107
		$config = new Config();
108
109
		$config->mode       = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
110
		$config->account_id = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_account_id', true );
111
		$config->site_id    = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_id', true );
112
		$config->site_code  = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_code', true );
113
114
		if ( Gateway::MODE_TEST === $config->mode ) {
115
			$config->api_url = MultiSafepay::API_TEST_URL;
116
		} else {
117
			$config->api_url = MultiSafepay::API_PRODUCTION_URL;
118
		}
119
120
		return $config;
121
	}
122
123
	/**
124
	 * Get gateway.
125
	 *
126
	 * @param int $post_id Post ID.
127
	 * @return Gateway
128
	 */
129
	public function get_gateway( $post_id ) {
130
		return new Gateway( $this->get_config( $post_id ) );
131
	}
132
}
133