Passed
Push — develop ( 8d76e2...f3d7f4 )
by Remco
02:26
created
src/Gateway.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param Pronamic_WP_Pay_GatewayConfig $config
39 39
 	 */
40
-	public function __construct( Config $config ) {
41
-		parent::__construct( $config );
40
+	public function __construct(Config $config) {
41
+		parent::__construct($config);
42 42
 
43
-		$this->set_method( self::METHOD_HTTP_REDIRECT );
44
-		$this->set_has_feedback( true );
45
-		$this->set_amount_minimum( 0.01 );
46
-		$this->set_slug( self::SLUG );
43
+		$this->set_method(self::METHOD_HTTP_REDIRECT);
44
+		$this->set_has_feedback(true);
45
+		$this->set_amount_minimum(0.01);
46
+		$this->set_slug(self::SLUG);
47 47
 
48 48
 		$this->client = new Adyen();
49 49
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param Pronamic_Pay_Payment $payment
57 57
 	 * @see Pronamic_WP_Pay_Gateway::start()
58 58
 	 */
59
-	public function start( Payment $payment ) {
59
+	public function start(Payment $payment) {
60 60
 		$url = 'https://checkout-test.adyen.com/v40/paymentMethods';
61 61
 
62 62
 		$data = (object) array(
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 			),
67 67
 		);
68 68
 
69
-		$response = wp_remote_post( $url, array(
69
+		$response = wp_remote_post($url, array(
70 70
 			'headers' => array(
71 71
 				'X-API-key'    => $this->config->api_key,
72 72
 				'Content-Type' => 'application/json',
73 73
 			),
74
-			'body'    => wp_json_encode( $data ),
75
-		) );
74
+			'body'    => wp_json_encode($data),
75
+		));
76 76
 
77
-		$body = wp_remote_retrieve_body( $response );
77
+		$body = wp_remote_retrieve_body($response);
78 78
 
79
-		$result = json_decode( $body );
79
+		$result = json_decode($body);
80 80
 
81 81
 		$payment_methods = $result->paymentMethods;
82
-		$payment_method  = reset( $payment_methods );
82
+		$payment_method  = reset($payment_methods);
83 83
 
84 84
 		$url = 'https://checkout-test.adyen.com/v40/payments';
85 85
 
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
 			'merchantAccount' => $this->config->merchant_account,
97 97
 		);
98 98
 
99
-		$response = wp_remote_post( $url, array(
99
+		$response = wp_remote_post($url, array(
100 100
 			'headers' => array(
101 101
 				'X-API-key'    => $this->config->api_key,
102 102
 				'Content-Type' => 'application/json',
103 103
 			),
104
-			'body'    => wp_json_encode( $data ),
105
-		) );
104
+			'body'    => wp_json_encode($data),
105
+		));
106 106
 
107
-		if ( '200' !== strval( wp_remote_retrieve_response_code( $response ) ) ) {
107
+		if ('200' !== strval(wp_remote_retrieve_response_code($response))) {
108 108
 			return;
109 109
 		}
110 110
 
111
-		$body = wp_remote_retrieve_body( $response );
111
+		$body = wp_remote_retrieve_body($response);
112 112
 
113
-		$result = json_decode( $body );
113
+		$result = json_decode($body);
114 114
 
115
-		if ( isset( $result->redirect, $result->redirect->url ) ) {
116
-			$payment->set_action_url( $result->redirect->url );
115
+		if (isset($result->redirect, $result->redirect->url)) {
116
+			$payment->set_action_url($result->redirect->url);
117 117
 		}
118 118
 	}
119 119
 
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 * Constructs and initialize settings.
25 25
 	 */
26 26
 	public function __construct() {
27
-		add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
28
-		add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) );
27
+		add_filter('pronamic_pay_gateway_sections', array($this, 'sections'));
28
+		add_filter('pronamic_pay_gateway_fields', array($this, 'fields'));
29 29
 	}
30 30
 
31 31
 	/**
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * @param array $sections Sections.
35 35
 	 * @return array
36 36
 	 */
37
-	public function sections( array $sections ) {
37
+	public function sections(array $sections) {
38 38
 		$sections['adyen'] = array(
39
-			'title'   => __( 'Adyen', 'pronamic_ideal' ),
40
-			'methods' => array( 'adyen' ),
39
+			'title'   => __('Adyen', 'pronamic_ideal'),
40
+			'methods' => array('adyen'),
41 41
 		);
42 42
 
43 43
 		return $sections;
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 	 * @param array $fields Fields.
50 50
 	 * @return array
51 51
 	 */
52
-	public function fields( array $fields ) {
52
+	public function fields(array $fields) {
53 53
 		// API Key.
54 54
 		$fields[] = array(
55 55
 			'filter'   => FILTER_SANITIZE_STRING,
56 56
 			'section'  => 'adyen',
57 57
 			'meta_key' => '_pronamic_gateway_adyen_api_key',
58
-			'title'    => _x( 'API Key', 'adyen', 'pronamic_ideal' ),
58
+			'title'    => _x('API Key', 'adyen', 'pronamic_ideal'),
59 59
 			'type'     => 'text',
60
-			'classes'  => array( 'regular-text', 'code' ),
61
-			'methods'  => array( 'adyen' ),
62
-			'tooltip'  => __( 'API key as mentioned in the payment provider dashboard', 'pronamic_ideal' ),
60
+			'classes'  => array('regular-text', 'code'),
61
+			'methods'  => array('adyen'),
62
+			'tooltip'  => __('API key as mentioned in the payment provider dashboard', 'pronamic_ideal'),
63 63
 		);
64 64
 
65 65
 		// Merchant Account.
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 			'filter'   => FILTER_SANITIZE_STRING,
68 68
 			'section'  => 'adyen',
69 69
 			'meta_key' => '_pronamic_gateway_adyen_merchant_account',
70
-			'title'    => _x( 'Merchant Account', 'adyen', 'pronamic_ideal' ),
70
+			'title'    => _x('Merchant Account', 'adyen', 'pronamic_ideal'),
71 71
 			'type'     => 'text',
72
-			'classes'  => array( 'regular-text', 'code' ),
73
-			'methods'  => array( 'adyen' ),
74
-			'tooltip'  => __( 'The merchant account identifier, with which you want to process the transaction', 'pronamic_ideal' ),
72
+			'classes'  => array('regular-text', 'code'),
73
+			'methods'  => array('adyen'),
74
+			'tooltip'  => __('The merchant account identifier, with which you want to process the transaction', 'pronamic_ideal'),
75 75
 		);
76 76
 
77 77
 		return $fields;
Please login to merge, or discard this patch.
src/ConfigFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
 	 * @param string $post_id Post ID.
27 27
 	 * @return Config
28 28
 	 */
29
-	public function get_config( $post_id ) {
29
+	public function get_config($post_id) {
30 30
 		$config = new Config();
31 31
 
32
-		$config->post_id          = intval( $post_id );
33
-		$config->mode             = $this->get_meta( $post_id, 'mode' );
34
-		$config->api_key          = $this->get_meta( $post_id, 'adyen_api_key' );
35
-		$config->merchant_account = $this->get_meta( $post_id, 'adyen_merchant_account' );
32
+		$config->post_id          = intval($post_id);
33
+		$config->mode             = $this->get_meta($post_id, 'mode');
34
+		$config->api_key          = $this->get_meta($post_id, 'adyen_api_key');
35
+		$config->merchant_account = $this->get_meta($post_id, 'adyen_merchant_account');
36 36
 
37 37
 		return $config;
38 38
 	}
Please login to merge, or discard this patch.