Test Failed
Push — develop ( 7cb291...9cc0c5 )
by Reüel
03:00
created

src/Config.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico;
4
5
use Pronamic\WordPress\Pay\Core\Gateway as Core_Gateway;
6
use Pronamic\WordPress\Pay\Core\GatewayConfig;
7
8
/**
9
 * Title: Ingenico config
10
 * Description:
11
 * Copyright: 2005-2019 Pronamic
12
 * Company: Pronamic
13
 *
14
 * @author  Remco Tolsma
15
 * @version 2.0.0
16
 * @since   1.0.0
17
 */
18
class Config extends GatewayConfig {
19
	/**
20
	 * Ogone PSPID.
21
	 *
22
	 * The PSPID is the unique identifier of your Ogone account. It is the ID you chose (or were given) at the
23
	 * registration of your Ogone account, and which you usually login with.
24
	 *
25
	 * When configured in your shopping cart, our system will use the PSPID to identify you as a registered merchant.
26
	 *
27
	 * @link https://payment-services.ingenico.com/int/en/ogone/support/guides/user%20guides/shopping-carts/what-is-a-pspid
28
	 * @var string
29
	 */
30
	public $psp_id;
31
32
	/**
33
	 * The Ogone e-Commerce form action URL.
34
	 *
35
	 * @since 1.2.9
36
	 * @link https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/e-commerce/link-your-website-to-the-payment-page#formaction
37
	 * @var string
38
	 */
39
	public $form_action_url;
40
41
	/**
42
	 * Constructs and initializes Ogone config object.
43
	 */
44
	public function __construct() {
45
		$this->set_form_action_url( $this->get_default_form_action_url() );
46
	}
47
48
	/**
49
	 * Get the default Ogone e-Commerce form action URL.
50
	 *
51
	 * @since 1.2.9
52
	 * @return string
53
	 */
54
	protected function get_default_form_action_url() {
55
		$is_utf8 = strcasecmp( get_bloginfo( 'charset' ), 'UTF-8' ) === 0;
0 ignored issues
show
The function get_bloginfo was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

55
		$is_utf8 = strcasecmp( /** @scrutinizer ignore-call */ get_bloginfo( 'charset' ), 'UTF-8' ) === 0;
Loading history...
56
57
		if ( $is_utf8 ) {
58
			return 'https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp';
59
		}
60
61
		return 'https://secure.ogone.com/ncol/prod/orderstandard.asp';
62
	}
63
64
	/**
65
	 * Get the Ogone e-Commerce form action URL.
66
	 *
67
	 * @since 1.2.9
68
	 * @return string
69
	 */
70
	public function get_form_action_url() {
71
		return $this->form_action_url;
72
	}
73
74
	/**
75
	 * Set the Ogone e-Commerce form action URL.
76
	 *
77
	 * @since 1.2.9
78
	 *
79
	 * @param string $url Ogone e-Commerce form action URL.
80
	 */
81
	public function set_form_action_url( $url ) {
82
		$this->form_action_url = $url;
83
	}
84
85
	/**
86
	 * Get Ogone payment server URL.
87
	 *
88
	 * @return string
89
	 * @deprecated deprecated since version 1.2.9, use get_form_action_url() instead.
90
	 */
91
	public function get_payment_server_url() {
92
		return $this->get_form_action_url();
93
	}
94
95
	/**
96
	 * Get Direct Query URL.
97
	 *
98
	 * @since 1.3.2
99
	 * @return string
100
	 */
101
	public function get_direct_query_url() {
102
		if ( Core_Gateway::MODE_TEST === $this->mode ) {
103
			return 'https://secure.ogone.com/ncol/test/querydirect.asp';
104
		}
105
106
		return 'https://secure.ogone.com/ncol/prod/querydirect.asp';
107
	}
108
}
109