@@ -23,10 +23,10 @@ |
||
23 | 23 | $this->provider = 'nocks'; |
24 | 24 | |
25 | 25 | // Actions |
26 | - $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
|
26 | + $function = array(__NAMESPACE__ . '\Listener', 'listen'); |
|
27 | 27 | |
28 | - if ( ! has_action( 'wp_loaded', $function ) ) { |
|
29 | - add_action( 'wp_loaded', $function ); |
|
28 | + if ( ! has_action('wp_loaded', $function)) { |
|
29 | + add_action('wp_loaded', $function); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 |
@@ -16,28 +16,28 @@ |
||
16 | 16 | */ |
17 | 17 | class Listener { |
18 | 18 | public static function listen() { |
19 | - if ( ! filter_has_var( INPUT_GET, 'nocks_webhook' ) ) { |
|
19 | + if ( ! filter_has_var(INPUT_GET, 'nocks_webhook')) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | - $transaction_id = file_get_contents( 'php://input' ); |
|
23 | + $transaction_id = file_get_contents('php://input'); |
|
24 | 24 | |
25 | - $payment = get_pronamic_payment_by_transaction_id( $transaction_id ); |
|
25 | + $payment = get_pronamic_payment_by_transaction_id($transaction_id); |
|
26 | 26 | |
27 | - if ( null === $payment ) { |
|
27 | + if (null === $payment) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
31 | 31 | // Add note. |
32 | 32 | $note = sprintf( |
33 | 33 | /* translators: %s: Nocks */ |
34 | - __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
|
35 | - __( 'Nocks', 'pronamic_ideal' ) |
|
34 | + __('Webhook requested by %s.', 'pronamic_ideal'), |
|
35 | + __('Nocks', 'pronamic_ideal') |
|
36 | 36 | ); |
37 | 37 | |
38 | - $payment->add_note( $note ); |
|
38 | + $payment->add_note($note); |
|
39 | 39 | |
40 | 40 | // Update payment. |
41 | - Plugin::update_payment( $payment, false ); |
|
41 | + Plugin::update_payment($payment, false); |
|
42 | 42 | } |
43 | 43 | } |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | * Settings constructor. |
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | - add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
24 | - add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
23 | + add_filter('pronamic_pay_gateway_sections', array($this, 'sections')); |
|
24 | + add_filter('pronamic_pay_gateway_fields', array($this, 'fields')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return array |
33 | 33 | */ |
34 | - public function sections( array $sections ) { |
|
34 | + public function sections(array $sections) { |
|
35 | 35 | $sections['nocks'] = array( |
36 | - 'title' => __( 'Nocks', 'pronamic_ideal' ), |
|
37 | - 'methods' => array( 'nocks' ), |
|
36 | + 'title' => __('Nocks', 'pronamic_ideal'), |
|
37 | + 'methods' => array('nocks'), |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | // Transaction feedback. |
41 | 41 | $sections['nocks_feedback'] = array( |
42 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
43 | - 'methods' => array( 'nocks' ), |
|
44 | - 'description' => __( 'Payment status updates will be processed without any additional configuration. The <em>Webhook URL</em> is being used to receive the status updates.', 'pronamic_ideal' ), |
|
42 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
43 | + 'methods' => array('nocks'), |
|
44 | + 'description' => __('Payment status updates will be processed without any additional configuration. The <em>Webhook URL</em> is being used to receive the status updates.', 'pronamic_ideal'), |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | return $sections; |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return array |
56 | 56 | */ |
57 | - public function fields( array $fields ) { |
|
57 | + public function fields(array $fields) { |
|
58 | 58 | // Access token. |
59 | 59 | $fields[] = array( |
60 | 60 | 'filter' => FILTER_SANITIZE_STRING, |
61 | 61 | 'section' => 'nocks', |
62 | 62 | 'meta_key' => '_pronamic_gateway_nocks_access_token', |
63 | - 'title' => _x( 'Access Token', 'nocks', 'pronamic_ideal' ), |
|
63 | + 'title' => _x('Access Token', 'nocks', 'pronamic_ideal'), |
|
64 | 64 | 'type' => 'textarea', |
65 | - 'classes' => array( 'code' ), |
|
65 | + 'classes' => array('code'), |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | // Merchant profile. |
@@ -70,32 +70,32 @@ discard block |
||
70 | 70 | 'filter' => FILTER_SANITIZE_STRING, |
71 | 71 | 'section' => 'nocks', |
72 | 72 | 'meta_key' => '_pronamic_gateway_nocks_merchant_profile', |
73 | - 'title' => _x( 'Merchant Profile', 'nocks', 'pronamic_ideal' ), |
|
73 | + 'title' => _x('Merchant Profile', 'nocks', 'pronamic_ideal'), |
|
74 | 74 | 'type' => 'description', |
75 | - 'callback' => array( $this, 'field_merchant_profile' ), |
|
75 | + 'callback' => array($this, 'field_merchant_profile'), |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | // Transaction feedback. |
79 | 79 | $fields[] = array( |
80 | 80 | 'section' => 'nocks', |
81 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
81 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
82 | 82 | 'type' => 'description', |
83 | 83 | 'html' => sprintf( |
84 | 84 | '<span class="dashicons dashicons-yes"></span> %s', |
85 | - __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
85 | + __('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal') |
|
86 | 86 | ), |
87 | 87 | ); |
88 | 88 | |
89 | 89 | // Webhook URL. |
90 | 90 | $fields[] = array( |
91 | 91 | 'section' => 'nocks_feedback', |
92 | - 'title' => __( 'Webhook URL', 'pronamic_ideal' ), |
|
92 | + 'title' => __('Webhook URL', 'pronamic_ideal'), |
|
93 | 93 | 'type' => 'text', |
94 | - 'classes' => array( 'large-text', 'code' ), |
|
95 | - 'value' => add_query_arg( 'nocks_webhook', '', home_url( '/' ) ), |
|
94 | + 'classes' => array('large-text', 'code'), |
|
95 | + 'value' => add_query_arg('nocks_webhook', '', home_url('/')), |
|
96 | 96 | 'readonly' => true, |
97 | - 'methods' => array( 'nocks' ), |
|
98 | - 'tooltip' => __( 'The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
|
97 | + 'methods' => array('nocks'), |
|
98 | + 'tooltip' => __('The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal'), |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | return $fields; |
@@ -106,28 +106,28 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param array $field Settings field. |
108 | 108 | */ |
109 | - public function field_merchant_profile( $field ) { |
|
110 | - $access_token = get_post_meta( get_the_ID(), '_pronamic_gateway_nocks_access_token', true ); |
|
111 | - $merchant_profile = get_post_meta( get_the_ID(), '_pronamic_gateway_nocks_merchant_profile', true ); |
|
109 | + public function field_merchant_profile($field) { |
|
110 | + $access_token = get_post_meta(get_the_ID(), '_pronamic_gateway_nocks_access_token', true); |
|
111 | + $merchant_profile = get_post_meta(get_the_ID(), '_pronamic_gateway_nocks_merchant_profile', true); |
|
112 | 112 | |
113 | - if ( ! $access_token ) { |
|
114 | - esc_html_e( 'First enter an API Key and save the configuration, to be able to choose from your Nocks merchant profiles.', 'pronamic_ideal' ); |
|
113 | + if ( ! $access_token) { |
|
114 | + esc_html_e('First enter an API Key and save the configuration, to be able to choose from your Nocks merchant profiles.', 'pronamic_ideal'); |
|
115 | 115 | |
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $client = new Client(); |
120 | 120 | |
121 | - $client->set_access_token( $access_token ); |
|
121 | + $client->set_access_token($access_token); |
|
122 | 122 | |
123 | 123 | // Select merchant profile. |
124 | - printf( '<select name="%s">', esc_attr( $field['meta_key'] ) ); |
|
124 | + printf('<select name="%s">', esc_attr($field['meta_key'])); |
|
125 | 125 | |
126 | 126 | $options = array( |
127 | - __( '— Select Merchant Profile —', 'pronamic_ideal' ), |
|
127 | + __('— Select Merchant Profile —', 'pronamic_ideal'), |
|
128 | 128 | ); |
129 | 129 | |
130 | - $options = array_merge( $options, $client->get_merchant_profiles() ); |
|
130 | + $options = array_merge($options, $client->get_merchant_profiles()); |
|
131 | 131 | |
132 | 132 | $options = array( |
133 | 133 | array( |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ), |
136 | 136 | ); |
137 | 137 | |
138 | - echo Pay_Util::select_options_grouped( $options, $merchant_profile ); // WPCS: xss ok. |
|
138 | + echo Pay_Util::select_options_grouped($options, $merchant_profile); // WPCS: xss ok. |
|
139 | 139 | |
140 | 140 | echo '</select>'; |
141 | 141 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | * @since 1.0.0 |
16 | 16 | */ |
17 | 17 | class ConfigFactory extends GatewayConfigFactory { |
18 | - public function get_config( $post_id ) { |
|
18 | + public function get_config($post_id) { |
|
19 | 19 | $config = new Config(); |
20 | 20 | |
21 | 21 | $config->post_id = $post_id; |
22 | - $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
23 | - $config->access_token = get_post_meta( $post_id, '_pronamic_gateway_nocks_access_token', true ); |
|
24 | - $config->merchant_profile = get_post_meta( $post_id, '_pronamic_gateway_nocks_merchant_profile', true ); |
|
22 | + $config->mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
23 | + $config->access_token = get_post_meta($post_id, '_pronamic_gateway_nocks_access_token', true); |
|
24 | + $config->merchant_profile = get_post_meta($post_id, '_pronamic_gateway_nocks_merchant_profile', true); |
|
25 | 25 | |
26 | 26 | return $config; |
27 | 27 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param string $access_token Access token. |
75 | 75 | */ |
76 | - public function set_access_token( $access_token ) { |
|
76 | + public function set_access_token($access_token) { |
|
77 | 77 | $this->access_token = $access_token; |
78 | 78 | } |
79 | 79 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @param string $merchant_profile Merchant profile id. |
91 | 91 | */ |
92 | - public function set_merchant_profile( $merchant_profile ) { |
|
92 | + public function set_merchant_profile($merchant_profile) { |
|
93 | 93 | $this->merchant_profile = $merchant_profile; |
94 | 94 | } |
95 | 95 | |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function get_issuers() { |
100 | 100 | return array( |
101 | - 'ABNANL2A' => __( 'ABN Amro', 'pronamic_ideal' ), |
|
102 | - 'RABONL2U' => __( 'Rabobank', 'pronamic_ideal' ), |
|
103 | - 'INGBNL2A' => __( 'ING Bank', 'pronamic_ideal' ), |
|
104 | - 'SNSBNL2A' => __( 'SNS Bank', 'pronamic_ideal' ), |
|
105 | - 'ASNBNL21' => __( 'ASN Bank', 'pronamic_ideal' ), |
|
106 | - 'RBRBNL21' => __( 'RegioBank', 'pronamic_ideal' ), |
|
107 | - 'TRIONL2U' => __( 'Triodos Bank', 'pronamic_ideal' ), |
|
108 | - 'FVLBNL22' => __( 'Van Lanschot', 'pronamic_ideal' ), |
|
109 | - 'KNABNL2H' => __( 'Knab', 'pronamic_ideal' ), |
|
110 | - 'BUNQNL2A' => __( 'Bunq', 'pronamic_ideal' ), |
|
101 | + 'ABNANL2A' => __('ABN Amro', 'pronamic_ideal'), |
|
102 | + 'RABONL2U' => __('Rabobank', 'pronamic_ideal'), |
|
103 | + 'INGBNL2A' => __('ING Bank', 'pronamic_ideal'), |
|
104 | + 'SNSBNL2A' => __('SNS Bank', 'pronamic_ideal'), |
|
105 | + 'ASNBNL21' => __('ASN Bank', 'pronamic_ideal'), |
|
106 | + 'RBRBNL21' => __('RegioBank', 'pronamic_ideal'), |
|
107 | + 'TRIONL2U' => __('Triodos Bank', 'pronamic_ideal'), |
|
108 | + 'FVLBNL22' => __('Van Lanschot', 'pronamic_ideal'), |
|
109 | + 'KNABNL2H' => __('Knab', 'pronamic_ideal'), |
|
110 | + 'BUNQNL2A' => __('Bunq', 'pronamic_ideal'), |
|
111 | 111 | ); |
112 | 112 | } |
113 | 113 | |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return bool|object |
123 | 123 | */ |
124 | - private function send_request( $end_point, $method = 'GET', array $data = array(), $expected_response_code = 200 ) { |
|
124 | + private function send_request($end_point, $method = 'GET', array $data = array(), $expected_response_code = 200) { |
|
125 | 125 | // Request. |
126 | 126 | $url = self::API_URL . $end_point; |
127 | 127 | |
128 | - if ( is_array( $data ) && ! empty( $data ) ) { |
|
129 | - $data = wp_json_encode( $data ); |
|
128 | + if (is_array($data) && ! empty($data)) { |
|
129 | + $data = wp_json_encode($data); |
|
130 | 130 | } |
131 | 131 | |
132 | - $response = wp_remote_request( $url, array( |
|
132 | + $response = wp_remote_request($url, array( |
|
133 | 133 | 'method' => $method, |
134 | 134 | 'headers' => array( |
135 | 135 | 'Accept' => 'application/json', |
@@ -137,29 +137,29 @@ discard block |
||
137 | 137 | 'Authorization' => 'Bearer ' . $this->get_access_token(), |
138 | 138 | ), |
139 | 139 | 'body' => $data, |
140 | - ) ); |
|
140 | + )); |
|
141 | 141 | |
142 | 142 | // Response code. |
143 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
143 | + $response_code = wp_remote_retrieve_response_code($response); |
|
144 | 144 | |
145 | - if ( $expected_response_code != $response_code ) { // WPCS: loose comparison ok. |
|
146 | - $this->error = new WP_Error( 'nocks_error', 'Unexpected response code.' ); |
|
145 | + if ($expected_response_code != $response_code) { // WPCS: loose comparison ok. |
|
146 | + $this->error = new WP_Error('nocks_error', 'Unexpected response code.'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Body. |
150 | - $body = wp_remote_retrieve_body( $response ); |
|
150 | + $body = wp_remote_retrieve_body($response); |
|
151 | 151 | |
152 | - $data = json_decode( $body ); |
|
152 | + $data = json_decode($body); |
|
153 | 153 | |
154 | - if ( ! is_object( $data ) ) { |
|
155 | - $this->error = new WP_Error( 'nocks_error', 'Could not parse response.' ); |
|
154 | + if ( ! is_object($data)) { |
|
155 | + $this->error = new WP_Error('nocks_error', 'Could not parse response.'); |
|
156 | 156 | |
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Nocks error. |
161 | - if ( isset( $data->error, $data->error->message ) ) { |
|
162 | - $this->error = new WP_Error( 'nocks_error', $data->error->message, $data->error ); |
|
161 | + if (isset($data->error, $data->error->message)) { |
|
162 | + $this->error = new WP_Error('nocks_error', $data->error->message, $data->error); |
|
163 | 163 | |
164 | 164 | return false; |
165 | 165 | } |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | public function get_merchant_profiles() { |
176 | 176 | $profiles = array(); |
177 | 177 | |
178 | - $merchants = $this->send_request( 'merchant', 'GET' ); |
|
178 | + $merchants = $this->send_request('merchant', 'GET'); |
|
179 | 179 | |
180 | - if ( $merchants ) { |
|
181 | - foreach ( $merchants->data as $merchant ) { |
|
182 | - foreach ( $merchant->merchant_profiles->data as $profile ) { |
|
183 | - $profiles[ $profile->uuid ] = $merchant->name . ' - ' . $profile->name; |
|
180 | + if ($merchants) { |
|
181 | + foreach ($merchants->data as $merchant) { |
|
182 | + foreach ($merchant->merchant_profiles->data as $profile) { |
|
183 | + $profiles[$profile->uuid] = $merchant->name . ' - ' . $profile->name; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return array|bool|mixed|object |
197 | 197 | */ |
198 | - public function start_transaction( Transaction $transaction ) { |
|
198 | + public function start_transaction(Transaction $transaction) { |
|
199 | 199 | return $this->send_request( |
200 | 200 | 'transaction', |
201 | 201 | 'POST', |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @return array|bool|mixed|object |
213 | 213 | */ |
214 | - public function get_transaction( $transaction_uuid ) { |
|
214 | + public function get_transaction($transaction_uuid) { |
|
215 | 215 | return $this->send_request( |
216 | 216 | 'transaction/' . $transaction_uuid, |
217 | 217 | 'GET' |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @return array|bool|mixed|object |
230 | 230 | */ |
231 | - public function get_transaction_quote( $source_currency, $target_currency, $amount, $payment_method ) { |
|
231 | + public function get_transaction_quote($source_currency, $target_currency, $amount, $payment_method) { |
|
232 | 232 | $data = array( |
233 | 233 | 'source_currency' => $source_currency, |
234 | 234 | 'target_currency' => $target_currency, |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | 'amount' => (string) $amount, |
238 | 238 | 'currency' => $source_currency, |
239 | 239 | ), |
240 | - 'payment_method' => array( 'method' => $payment_method ), |
|
240 | + 'payment_method' => array('method' => $payment_method), |
|
241 | 241 | ); |
242 | 242 | |
243 | 243 | return $this->send_request( |
@@ -64,8 +64,8 @@ |
||
64 | 64 | * |
65 | 65 | * @return string|null |
66 | 66 | */ |
67 | - public static function transform( $status ) { |
|
68 | - switch ( $status ) { |
|
67 | + public static function transform($status) { |
|
68 | + switch ($status) { |
|
69 | 69 | case self::CANCELLED: |
70 | 70 | return Core_Statuses::CANCELLED; |
71 | 71 |
@@ -60,8 +60,8 @@ |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public static function transform( $payment_method ) { |
|
64 | - switch ( $payment_method ) { |
|
63 | + public static function transform($payment_method) { |
|
64 | + switch ($payment_method) { |
|
65 | 65 | case PaymentMethods::GULDEN: |
66 | 66 | return self::GULDEN; |
67 | 67 | default: |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param Config $config Config. |
24 | 24 | */ |
25 | - public function __construct( Config $config ) { |
|
26 | - parent::__construct( $config ); |
|
25 | + public function __construct(Config $config) { |
|
26 | + parent::__construct($config); |
|
27 | 27 | |
28 | - $this->set_method( Gateway::METHOD_HTTP_REDIRECT ); |
|
29 | - $this->set_has_feedback( true ); |
|
30 | - $this->set_amount_minimum( 0.01 ); |
|
28 | + $this->set_method(Gateway::METHOD_HTTP_REDIRECT); |
|
29 | + $this->set_has_feedback(true); |
|
30 | + $this->set_amount_minimum(0.01); |
|
31 | 31 | |
32 | 32 | // Client. |
33 | 33 | $this->client = new Client(); |
34 | 34 | |
35 | - $this->client->set_access_token( $config->access_token ); |
|
36 | - $this->client->set_merchant_profile( $config->merchant_profile ); |
|
35 | + $this->client->set_access_token($config->access_token); |
|
36 | + $this->client->set_merchant_profile($config->merchant_profile); |
|
37 | 37 | |
38 | 38 | // Feature supports. |
39 | 39 | $this->supports = array( |
@@ -59,22 +59,22 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @param Payment $payment The payment. |
61 | 61 | */ |
62 | - public function start( Payment $payment ) { |
|
62 | + public function start(Payment $payment) { |
|
63 | 63 | $payment_method = $payment->get_method(); |
64 | 64 | $currency = $payment->get_currency(); |
65 | 65 | $amount = $payment->get_amount()->get_amount(); |
66 | 66 | |
67 | - if ( empty( $payment_method ) ) { |
|
67 | + if (empty($payment_method)) { |
|
68 | 68 | $payment_method = PaymentMethods::GULDEN; |
69 | 69 | } |
70 | 70 | |
71 | - if ( PaymentMethods::GULDEN === $payment_method ) { |
|
72 | - switch ( $currency ) { |
|
71 | + if (PaymentMethods::GULDEN === $payment_method) { |
|
72 | + switch ($currency) { |
|
73 | 73 | case 'EUR': |
74 | 74 | // Convert to EUR. |
75 | - $quote = $this->client->get_transaction_quote( 'EUR', 'NLG', $amount, Methods::IDEAL ); |
|
75 | + $quote = $this->client->get_transaction_quote('EUR', 'NLG', $amount, Methods::IDEAL); |
|
76 | 76 | |
77 | - if ( $quote ) { |
|
77 | + if ($quote) { |
|
78 | 78 | $amount = $quote->data->target_amount->amount; |
79 | 79 | $currency = 'NLG'; |
80 | 80 | } |
@@ -91,31 +91,31 @@ discard block |
||
91 | 91 | $transaction->currency = $currency; |
92 | 92 | $transaction->amount = $amount; |
93 | 93 | $transaction->locale = $payment->get_locale(); |
94 | - $transaction->payment_method = Methods::transform( $payment->get_method() ); |
|
94 | + $transaction->payment_method = Methods::transform($payment->get_method()); |
|
95 | 95 | $transaction->redirect_url = $payment->get_return_url(); |
96 | - $transaction->callback_url = add_query_arg( 'nocks_webhook', '', home_url( '/' ) ); |
|
96 | + $transaction->callback_url = add_query_arg('nocks_webhook', '', home_url('/')); |
|
97 | 97 | $transaction->description = $payment->get_description(); |
98 | 98 | |
99 | - if ( Methods::IDEAL === $transaction->payment_method ) { |
|
99 | + if (Methods::IDEAL === $transaction->payment_method) { |
|
100 | 100 | $transaction->issuer = $payment->get_issuer(); |
101 | 101 | } |
102 | 102 | |
103 | - $result = $this->client->start_transaction( $transaction ); |
|
103 | + $result = $this->client->start_transaction($transaction); |
|
104 | 104 | |
105 | 105 | $error = $this->client->get_error(); |
106 | 106 | |
107 | - if ( is_wp_error( $error ) ) { |
|
107 | + if (is_wp_error($error)) { |
|
108 | 108 | $this->error = $error; |
109 | 109 | |
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | - if ( isset( $result->data->payments->data[0]->uuid ) ) { |
|
114 | - $payment->set_transaction_id( $result->data->uuid ); |
|
113 | + if (isset($result->data->payments->data[0]->uuid)) { |
|
114 | + $payment->set_transaction_id($result->data->uuid); |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( isset( $result->data->payments->data[0]->metadata->url ) ) { |
|
118 | - $payment->set_action_url( $result->data->payments->data[0]->metadata->url ); |
|
117 | + if (isset($result->data->payments->data[0]->metadata->url)) { |
|
118 | + $payment->set_action_url($result->data->payments->data[0]->metadata->url); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -124,23 +124,23 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param Payment $payment The payment. |
126 | 126 | */ |
127 | - public function update_status( Payment $payment ) { |
|
127 | + public function update_status(Payment $payment) { |
|
128 | 128 | $transaction_id = $payment->get_transaction_id(); |
129 | 129 | |
130 | - $nocks_payment = $this->client->get_transaction( $transaction_id ); |
|
130 | + $nocks_payment = $this->client->get_transaction($transaction_id); |
|
131 | 131 | |
132 | - if ( ! $nocks_payment ) { |
|
133 | - $payment->set_status( Core_Statuses::FAILURE ); |
|
132 | + if ( ! $nocks_payment) { |
|
133 | + $payment->set_status(Core_Statuses::FAILURE); |
|
134 | 134 | |
135 | 135 | $this->error = $this->client->get_error(); |
136 | 136 | |
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | - if ( is_object( $nocks_payment ) && isset( $nocks_payment->data->status ) ) { |
|
141 | - $status = Statuses::transform( $nocks_payment->data->status ); |
|
140 | + if (is_object($nocks_payment) && isset($nocks_payment->data->status)) { |
|
141 | + $status = Statuses::transform($nocks_payment->data->status); |
|
142 | 142 | |
143 | - $payment->set_status( $status ); |
|
143 | + $payment->set_status($status); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |