Passed
Push — develop ( cccd30...237f61 )
by Reüel
04:46
created

GatewayIntegrations::get_integrations()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 196
Code Lines 149

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 149
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 196
rs 8.2857

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Gateway integrations.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2018 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay;
12
13
/**
14
 * Title: WordPress gateway integrations class.
15
 *
16
 * @author Reüel van der Steege
17
 * @version 1.0
18
 */
19
class GatewayIntegrations {
20
	/**
21
	 * Register gateway integrations.
22
	 *
23
	 * @return array
24
	 */
25
	public function register_integrations() {
26
		$integrations = $this->get_integrations();
27
28
		// Register config providers.
29
		foreach ( $integrations as $integration ) {
30
			Core\ConfigProvider::register( $integration->get_id(), $integration->get_config_factory_class() );
31
		}
32
33
		return $integrations;
34
	}
35
36
	/**
37
	 * Get gateway integrations.
38
	 *
39
	 * @return array
40
	 */
41
	private function get_integrations() {
42
		// ABN AMRO iDEAL Easy.
43
		$abn_amro_ideal_easy = new Gateways\Ingenico\OrderStandardEasy\Integration();
44
		$abn_amro_ideal_easy->set_id( 'abnamro-ideal-easy' );
45
		$abn_amro_ideal_easy->set_name( 'ABN AMRO - iDEAL Easy' );
46
		$abn_amro_ideal_easy->url           = 'https://internetkassa.abnamro.nl/';
47
		$abn_amro_ideal_easy->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
48
		$abn_amro_ideal_easy->dashboard_url = 'https://internetkassa.abnamro.nl/';
49
		$abn_amro_ideal_easy->provider      = 'abnamro';
50
51
		// ABN AMRO - iDEAL Only Kassa.
52
		$abn_amro_ideal_only_kassa = new Gateways\Ingenico\OrderStandard\Integration();
53
		$abn_amro_ideal_only_kassa->set_id( 'abnamro-ideal-only-kassa' );
54
		$abn_amro_ideal_only_kassa->set_name( 'ABN AMRO - iDEAL Only Kassa' );
55
		$abn_amro_ideal_only_kassa->url           = 'https://internetkassa.abnamro.nl/';
56
		$abn_amro_ideal_only_kassa->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
57
		$abn_amro_ideal_only_kassa->dashboard_url = 'https://internetkassa.abnamro.nl/';
58
		$abn_amro_ideal_only_kassa->provider      = 'abnamro';
59
60
		// ABN AMRO - Internetkassa.
61
		$abn_amro_internetkassa = new Gateways\Ingenico\OrderStandard\Integration();
62
		$abn_amro_internetkassa->set_id( 'abnamro-internetkassa' );
63
		$abn_amro_internetkassa->set_name( 'ABN AMRO - Internetkassa' );
64
		$abn_amro_internetkassa->url           = 'https://internetkassa.abnamro.nl/';
65
		$abn_amro_internetkassa->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
66
		$abn_amro_internetkassa->dashboard_url = 'https://internetkassa.abnamro.nl/';
67
		$abn_amro_internetkassa->provider      = 'abnamro';
68
69
		// ABN AMRO - iDEAL Zelfbouw (v3).
70
		$abn_amro_ideal_zelfbouw_v3 = new Gateways\IDeal_Advanced_V3\Integration();
71
		$abn_amro_ideal_zelfbouw_v3->set_id( 'abnamro-ideal-zelfbouw-v3' );
72
		$abn_amro_ideal_zelfbouw_v3->set_name( 'ABN AMRO - iDEAL Zelfbouw (v3)' );
73
		$abn_amro_ideal_zelfbouw_v3->url           = 'https://abnamro.ideal-payment.de/';
74
		$abn_amro_ideal_zelfbouw_v3->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
75
		$abn_amro_ideal_zelfbouw_v3->dashboard_url = array(
76
			'test' => 'https://abnamro-test.ideal-payment.de/',
77
			'live' => 'https://abnamro.ideal-payment.de/',
78
		);
79
		$abn_amro_ideal_zelfbouw_v3->provider      = 'abnamro';
80
81
		// Deutsche Bank - iDEAL via Ogone.
82
		$deutsche_bank_ideal_ogone = new Gateways\Ingenico\OrderStandardEasy\Integration();
83
		$deutsche_bank_ideal_ogone->set_id( 'deutschebank-ideal-via-ogone' );
84
		$deutsche_bank_ideal_ogone->set_name( 'Deutsche Bank - iDEAL via Ogone' );
85
		$deutsche_bank_ideal_ogone->product_url = 'https://www.deutschebank.nl/nl/content/producten_en_services_commercial_banking_cash_management_betalen_ideal.html';
86
		$deutsche_bank_ideal_ogone->provider    = 'deutschebank';
87
88
		// Deutsche Bank - iDEAL Expert (v3).
89
		$deutsche_bank_ideal_expert_v3 = new Gateways\IDeal_Advanced_V3\Integration();
90
		$deutsche_bank_ideal_expert_v3->set_id( 'deutschebank-ideal-expert-v3' );
91
		$deutsche_bank_ideal_expert_v3->set_name( 'Deutsche Bank - iDEAL Expert (v3)' );
92
		$deutsche_bank_ideal_expert_v3->product_url   = 'https://www.deutschebank.nl/nl/content/producten_en_services_commercial_banking_cash_management_betalen_ideal.html';
93
		$deutsche_bank_ideal_expert_v3->dashboard_url = array(
94
			'test' => 'https://myideal.test.db.com/',
95
			'live' => 'https://myideal.db.com/',
96
		);
97
		$deutsche_bank_ideal_expert_v3->provider      = 'deutschebank';
98
99
		// Fibonacci ORANGE.
100
		$fibonacci_orange = new Gateways\Icepay\Integration();
101
		$fibonacci_orange->set_id( 'fibonacciorange' );
102
		$fibonacci_orange->set_name( 'Fibonacci ORANGE' );
103
		$fibonacci_orange->product_url = 'http://www.fibonacciorange.nl/';
104
		$fibonacci_orange->provider    = 'fibonacciorange';
105
106
		// iDEAL Simulator - iDEAL Lite / Basic.
107
		$ideal_simulator_ideal_basic = new Gateways\IDeal_Basic\Integration();
108
		$ideal_simulator_ideal_basic->set_id( 'ideal-simulator-ideal-basic' );
109
		$ideal_simulator_ideal_basic->set_name( 'iDEAL Simulator - iDEAL Lite / Basic' );
110
		$ideal_simulator_ideal_basic->provider = 'ideal-simulator';
111
112
		// iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3).
113
		$ideal_simulator_ideal_advanced_v3 = new Gateways\IDeal_Advanced_V3\Integration();
114
		$ideal_simulator_ideal_advanced_v3->set_id( 'ideal-simulator-ideal-advanced-v3' );
115
		$ideal_simulator_ideal_advanced_v3->set_name( 'iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3)' );
116
		$ideal_simulator_ideal_advanced_v3->provider    = 'ideal-simulator';
117
		$ideal_simulator_ideal_advanced_v3->product_url = 'https://www.ideal-checkout.nl/support/ideal-simulator';
118
119
		// ING - iDEAL Basic.
120
		$ing_ideal_basic = new Gateways\IDeal_Basic\Integration();
121
		$ing_ideal_basic->set_id( 'ing-ideal-basic' );
122
		$ing_ideal_basic->set_name( 'ING - iDEAL Basic' );
123
		$ing_ideal_basic->provider      = 'ing';
124
		$ing_ideal_basic->product_url   = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/ideal/';
125
		$ing_ideal_basic->dashboard_url = array(
126
			'test' => 'https://idealtest.secure-ing.com/',
127
			'live' => 'https://ideal.secure-ing.com/',
128
		);
129
130
		// ING - iDEAL Advanced (v3).
131
		$ing_ideal_advanced_v3 = new Gateways\IDeal_Advanced_V3\Integration();
132
		$ing_ideal_advanced_v3->set_id( 'ing-ideal-advanced-v3' );
133
		$ing_ideal_advanced_v3->set_name( 'ING - iDEAL Advanced (v3)' );
134
		$ing_ideal_advanced_v3->provider      = 'ing';
135
		$ing_ideal_advanced_v3->product_url   = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/ideal/';
136
		$ing_ideal_advanced_v3->dashboard_url = array(
137
			'test' => 'https://idealtest.secure-ing.com/',
138
			'live' => 'https://ideal.secure-ing.com/',
139
		);
140
141
		// Mollie - iDEAL Basic.
142
		$mollie_ideal_basic = new Gateways\IDeal_Basic\Integration();
143
		$mollie_ideal_basic->set_id( 'mollie-ideal-basic' );
144
		$mollie_ideal_basic->set_name( 'Mollie - iDEAL Basic' );
145
		$mollie_ideal_basic->dashboard_url = 'http://www.mollie.nl/beheer/';
146
		$mollie_ideal_basic->provider      = 'mollie';
147
		$mollie_ideal_basic->deprecated    = true;
0 ignored issues
show
Bug introduced by
The property deprecated does not seem to exist on Pronamic\WordPress\Pay\G...IDeal_Basic\Integration.
Loading history...
148
149
		// Paytor.
150
		$paytor = new Gateways\Mollie\Integration();
151
		$paytor->set_id( 'paytor' );
152
		$paytor->set_name( 'Paytor' );
153
		$paytor->url         = 'http://paytor.com/';
154
		$paytor->product_url = 'http://paytor.com/';
155
		$paytor->provider    = 'paytor';
156
157
		// Postcode iDEAL.
158
		$postcode_ideal = new Gateways\IDeal_Advanced_V3\Integration();
159
		$postcode_ideal->set_id( 'postcode-ideal' );
160
		$postcode_ideal->set_name( 'Postcode iDEAL' );
161
		$postcode_ideal->provider      = 'postcode.nl';
162
		$postcode_ideal->product_url   = 'https://services.postcode.nl/ideal';
163
		$postcode_ideal->dashboard_url = 'https://services.postcode.nl/ideal';
164
165
		// Qantani (new platform).
166
		$qantani_mollie = new Gateways\Mollie\Integration();
167
		$qantani_mollie->set_id( 'qantani-mollie' );
168
		$qantani_mollie->set_name( __( 'Qantani (new platform)', 'pronamic_ideal' ) );
169
		$qantani_mollie->url           = 'https://www.qantani.com/';
170
		$qantani_mollie->product_url   = 'https://www.qantani.com/tarieven/';
171
		$qantani_mollie->dashboard_url = 'https://www.qantani.eu/';
172
		$qantani_mollie->provider      = 'qantani';
173
174
		// Rabobank - iDEAL Professional (v3).
175
		$rabobank_ideal_professional_v3 = new Gateways\IDeal_Advanced_V3\Integration();
176
		$rabobank_ideal_professional_v3->set_id( 'rabobank-ideal-professional-v3' );
177
		$rabobank_ideal_professional_v3->set_name( 'Rabobank - iDEAL Professional (v3)' );
178
		$rabobank_ideal_professional_v3->provider      = 'rabobank';
179
		$rabobank_ideal_professional_v3->product_url   = 'https://www.rabobank.nl/bedrijven/betalen/geld-ontvangen/ideal-professional/';
180
		$rabobank_ideal_professional_v3->dashboard_url = array(
181
			'test' => 'https://idealtest.rabobank.nl/',
182
			'live' => 'https://ideal.rabobank.nl/',
183
		);
184
185
		// Sisow - iDEAL Basic.
186
		$sisow_ideal_basic = new Gateways\IDeal_Basic\Integration();
187
		$sisow_ideal_basic->set_id( 'sisow-ideal-basic' );
188
		$sisow_ideal_basic->set_name( 'Sisow - iDEAL Basic' );
189
		$sisow_ideal_basic->url           = 'https://www.sisow.nl/';
190
		$sisow_ideal_basic->dashboard_url = 'https://www.sisow.nl/Sisow/iDeal/Login.aspx';
191
		$sisow_ideal_basic->provider      = 'sisow';
192
		$sisow_ideal_basic->deprecated    = true;
193
194
		// Integrations.
195
		$gateways = array(
196
			$abn_amro_ideal_easy,
197
			$abn_amro_ideal_only_kassa,
198
			$abn_amro_internetkassa,
199
			$abn_amro_ideal_zelfbouw_v3,
200
			new Gateways\Buckaroo\Integration(),
201
			$deutsche_bank_ideal_ogone,
202
			$deutsche_bank_ideal_expert_v3,
203
			new Gateways\EMS_ECommerce\Integration(),
204
			$fibonacci_orange,
205
			new Gateways\Icepay\Integration(),
206
			$ideal_simulator_ideal_basic,
207
			$ideal_simulator_ideal_advanced_v3,
208
			$ing_ideal_basic,
209
			$ing_ideal_advanced_v3,
210
			new Gateways\ING_KassaCompleet\Integration(),
211
			new Gateways\Mollie\Integration(),
212
			new Gateways\Mollie_IDeal\Integration(),
213
			$mollie_ideal_basic,
214
			new Gateways\MultiSafepay\Connect\Integration(),
215
			new Gateways\Ingenico\DirectLink\Integration(),
216
			new Gateways\Ingenico\OrderStandard\Integration(),
217
			new Gateways\OmniKassa\Integration(),
218
			new Gateways\OmniKassa2\Integration(),
219
			new Gateways\PayNL\Integration(),
220
			$paytor,
221
			$postcode_ideal,
222
			$qantani_mollie,
223
			$rabobank_ideal_professional_v3,
224
			new Gateways\Sisow\Integration(),
225
			$sisow_ideal_basic,
226
			new Gateways\TargetPay\Integration(),
227
		);
228
229
		$integrations = array();
230
231
		// Set integrations.
232
		foreach ( $gateways as $integration ) {
233
			$integrations[ $integration->get_id() ] = $integration;
234
		}
235
236
		return $integrations;
237
	}
238
}
239