Test Failed
Push — develop ( 8bdcfe...370527 )
by Reüel
13:59
created

src/Integration.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay;
4
5
use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration;
6
7
/**
8
 * Title: MultiSafepay Connect integration
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.2
15
 * @since   1.2.6
16
 */
17
class Integration extends AbstractIntegration {
18
	/**
19
	 * Integration constructor.
20
	 */
21
	public function __construct() {
22
		$this->id            = 'multisafepay-connect';
23
		$this->name          = 'MultiSafepay - Connect';
24
		$this->url           = 'http://www.multisafepay.com/';
25
		$this->product_url   = __( 'http://www.multisafepay.com/', 'pronamic_ideal' );
26
		$this->dashboard_url = 'https://merchant.multisafepay.com/';
27
		$this->provider      = 'multisafepay';
28
		$this->supports      = array(
29
			'payment_status_request',
30
			'webhook',
31
			'webhook_no_config',
32
		);
33
34
		$this->set_manual_url( __( 'https://www.pronamic.eu/support/how-to-connect-multisafepay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ) );
0 ignored issues
show
The method set_manual_url() does not exist on Pronamic\WordPress\Pay\G...ultiSafepay\Integration. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
		$this->/** @scrutinizer ignore-call */ 
35
         set_manual_url( __( 'https://www.pronamic.eu/support/how-to-connect-multisafepay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ) );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
	}
36
37
	public function get_settings_fields() {
38
		$fields = array();
39
40
		// Account ID
41
		$fields[] = array(
42
			'section'  => 'general',
43
			'filter'   => FILTER_SANITIZE_STRING,
44
			'meta_key' => '_pronamic_gateway_multisafepay_account_id',
45
			'title'    => __( 'Account ID', 'pronamic_ideal' ),
46
			'type'     => 'text',
47
			'classes'  => array( 'code' ),
48
			'tooltip'  => sprintf(
49
				'%s %s.',
50
				__( 'Account ID', 'pronamic_ideal' ),
51
				/* translators: %s: MultiSafepay */
52
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
53
			),
54
		);
55
56
		// Site ID
57
		$fields[] = array(
58
			'section'  => 'general',
59
			'filter'   => FILTER_SANITIZE_STRING,
60
			'meta_key' => '_pronamic_gateway_multisafepay_site_id',
61
			'title'    => __( 'Site ID', 'pronamic_ideal' ),
62
			'type'     => 'text',
63
			'classes'  => array( 'code' ),
64
			'tooltip'  => sprintf(
65
				'%s %s.',
66
				__( 'Site ID', 'pronamic_ideal' ),
67
				/* translators: %s: MultiSafepay */
68
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
69
			),
70
		);
71
72
		// Site Security Code
73
		$fields[] = array(
74
			'section'  => 'general',
75
			'filter'   => FILTER_SANITIZE_STRING,
76
			'meta_key' => '_pronamic_gateway_multisafepay_site_code',
77
			'title'    => __( 'Site Security Code', 'pronamic_ideal' ),
78
			'type'     => 'text',
79
			'classes'  => array( 'code' ),
80
			'tooltip'  => sprintf(
81
				'%s %s.',
82
				__( 'Site Security Code', 'pronamic_ideal' ),
83
				/* translators: %s: MultiSafepay */
84
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
85
			),
86
		);
87
88
		return $fields;
89
	}
90
91
	/**
92
	 * Get config.
93
	 *
94
	 * @param $post_id
95
	 *
96
	 * @return Config
97
	 */
98
	public function get_config( $post_id ) {
99
		$config = new Config();
100
101
		$config->mode       = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
102
		$config->account_id = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_account_id', true );
103
		$config->site_id    = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_id', true );
104
		$config->site_code  = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_code', true );
105
106
		if ( Gateway::MODE_TEST === $config->mode ) {
107
			$config->api_url = MultiSafepay::API_TEST_URL;
108
		} else {
109
			$config->api_url = MultiSafepay::API_PRODUCTION_URL;
110
		}
111
112
		return $config;
113
	}
114
115
	/**
116
	 * Get gateway.
117
	 *
118
	 * @param int $post_id Post ID.
119
	 * @return Gateway
120
	 */
121
	public function get_gateway( $post_id ) {
122
		return new Gateway( $this->get_config( $post_id ) );
123
	}
124
}
125