@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @param string $email_address E-mailadress of the consumer. |
66 | 66 | */ |
67 | - public function set_email_address( $email_address ) { |
|
67 | + public function set_email_address($email_address) { |
|
68 | 68 | $this->email_address = $email_address; |
69 | 69 | } |
70 | 70 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | 'telephoneNumber' => $this->telephone_number, |
83 | 83 | ); |
84 | 84 | |
85 | - $data = array_filter( $data ); |
|
85 | + $data = array_filter($data); |
|
86 | 86 | |
87 | - if ( empty( $data ) ) { |
|
87 | + if (empty($data)) { |
|
88 | 88 | return null; |
89 | 89 | } |
90 | 90 |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param array $order_results Order results. |
48 | 48 | * @param string $signature Signature. |
49 | 49 | */ |
50 | - public function __construct( $more_available, array $order_results, $signature ) { |
|
51 | - parent::__construct( $signature ); |
|
50 | + public function __construct($more_available, array $order_results, $signature) { |
|
51 | + parent::__construct($signature); |
|
52 | 52 | |
53 | 53 | $this->more_available = $more_available; |
54 | 54 | $this->order_results = $order_results; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $data[] = $this->more_available() ? 'true' : 'false'; |
75 | 75 | |
76 | - foreach ( $this->order_results as $order_result ) { |
|
76 | + foreach ($this->order_results as $order_result) { |
|
77 | 77 | $data[] = $order_result->get_merchant_order_id(); |
78 | 78 | $data[] = $order_result->get_omnikassa_order_id(); |
79 | 79 | $data[] = $order_result->get_poi_id(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return ArrayIterator |
96 | 96 | */ |
97 | 97 | public function getIterator() { |
98 | - return new ArrayIterator( $this->order_results ); |
|
98 | + return new ArrayIterator($this->order_results); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -105,27 +105,27 @@ discard block |
||
105 | 105 | * @return OrderResults |
106 | 106 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
107 | 107 | */ |
108 | - public static function from_object( stdClass $object ) { |
|
109 | - if ( ! isset( $object->signature ) ) { |
|
110 | - throw new InvalidArgumentException( 'Object must contain `signature` property.' ); |
|
108 | + public static function from_object(stdClass $object) { |
|
109 | + if ( ! isset($object->signature)) { |
|
110 | + throw new InvalidArgumentException('Object must contain `signature` property.'); |
|
111 | 111 | } |
112 | 112 | |
113 | - if ( ! isset( $object->moreOrderResultsAvailable ) ) { |
|
114 | - throw new InvalidArgumentException( 'Object must contain `moreOrderResultsAvailable` property.' ); |
|
113 | + if ( ! isset($object->moreOrderResultsAvailable)) { |
|
114 | + throw new InvalidArgumentException('Object must contain `moreOrderResultsAvailable` property.'); |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( ! isset( $object->orderResults ) ) { |
|
118 | - throw new InvalidArgumentException( 'Object must contain `orderResults` property.' ); |
|
117 | + if ( ! isset($object->orderResults)) { |
|
118 | + throw new InvalidArgumentException('Object must contain `orderResults` property.'); |
|
119 | 119 | } |
120 | 120 | |
121 | - if ( ! is_array( $object->orderResults ) ) { |
|
122 | - throw new InvalidArgumentException( 'The `orderResults` property must be an array.' ); |
|
121 | + if ( ! is_array($object->orderResults)) { |
|
122 | + throw new InvalidArgumentException('The `orderResults` property must be an array.'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $order_results = array(); |
126 | 126 | |
127 | - foreach ( $object->orderResults as $o ) { |
|
128 | - $order_results[] = OrderResult::from_object( $o ); |
|
127 | + foreach ($object->orderResults as $o) { |
|
128 | + $order_results[] = OrderResult::from_object($o); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return new self( |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | * @return OrderResults |
143 | 143 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
144 | 144 | */ |
145 | - public static function from_json( $json ) { |
|
146 | - $data = json_decode( $json ); |
|
145 | + public static function from_json($json) { |
|
146 | + $data = json_decode($json); |
|
147 | 147 | |
148 | 148 | $validator = new Validator(); |
149 | 149 | |
150 | 150 | $validator->validate( |
151 | 151 | $data, |
152 | 152 | (object) array( |
153 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/order-results.json' ), |
|
153 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/order-results.json'), |
|
154 | 154 | ), |
155 | 155 | Constraint::CHECK_MODE_EXCEPTIONS |
156 | 156 | ); |
157 | 157 | |
158 | - return self::from_object( $data ); |
|
158 | + return self::from_object($data); |
|
159 | 159 | } |
160 | 160 | } |
@@ -97,8 +97,8 @@ |
||
97 | 97 | * @param string $payment_method Payment method. |
98 | 98 | * @return string|null |
99 | 99 | */ |
100 | - public static function transform( $payment_method ) { |
|
101 | - switch ( $payment_method ) { |
|
100 | + public static function transform($payment_method) { |
|
101 | + switch ($payment_method) { |
|
102 | 102 | case PaymentMethods::BANCONTACT: |
103 | 103 | return self::BANCONTACT; |
104 | 104 | case PaymentMethods::CREDIT_CARD: |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * @param Money $amount Amount. |
152 | 152 | * @param string $merchant_return_url Merchant return URL. |
153 | 153 | */ |
154 | - public function __construct( $merchant_order_id, $amount, $merchant_return_url ) { |
|
155 | - $this->timestamp = date( DATE_ATOM ); |
|
154 | + public function __construct($merchant_order_id, $amount, $merchant_return_url) { |
|
155 | + $this->timestamp = date(DATE_ATOM); |
|
156 | 156 | $this->merchant_order_id = $merchant_order_id; |
157 | 157 | $this->amount = $amount; |
158 | 158 | $this->merchant_return_url = $merchant_return_url; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @param string $description Description. |
165 | 165 | */ |
166 | - public function set_description( $description ) { |
|
166 | + public function set_description($description) { |
|
167 | 167 | $this->description = $description; |
168 | 168 | } |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @param string $language Language. |
174 | 174 | */ |
175 | - public function set_language( $language ) { |
|
175 | + public function set_language($language) { |
|
176 | 176 | $this->language = $language; |
177 | 177 | } |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @param string|null $payment_brand Payment brand. |
183 | 183 | */ |
184 | - public function set_payment_brand( $payment_brand ) { |
|
184 | + public function set_payment_brand($payment_brand) { |
|
185 | 185 | $this->payment_brand = $payment_brand; |
186 | 186 | } |
187 | 187 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @param string $payment_brand_force Payment brand force. |
192 | 192 | */ |
193 | - public function set_payment_brand_force( $payment_brand_force ) { |
|
193 | + public function set_payment_brand_force($payment_brand_force) { |
|
194 | 194 | $this->payment_brand_force = $payment_brand_force; |
195 | 195 | } |
196 | 196 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | ); |
238 | 238 | |
239 | 239 | // Remove empty optional fields. |
240 | - $optional = array_filter( $optional ); |
|
240 | + $optional = array_filter($optional); |
|
241 | 241 | |
242 | - return array_merge( $fields, $optional ); |
|
242 | + return array_merge($fields, $optional); |
|
243 | 243 | } |
244 | 244 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param string $url URL. |
87 | 87 | */ |
88 | - public function set_url( $url ) { |
|
88 | + public function set_url($url) { |
|
89 | 89 | $this->url = $url; |
90 | 90 | } |
91 | 91 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param string $refresh_token Refresh token. |
105 | 105 | */ |
106 | - public function set_refresh_token( $refresh_token ) { |
|
106 | + public function set_refresh_token($refresh_token) { |
|
107 | 107 | $this->refresh_token = $refresh_token; |
108 | 108 | } |
109 | 109 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @param string $signing_key Signing key. |
123 | 123 | */ |
124 | - public function set_signing_key( $signing_key ) { |
|
124 | + public function set_signing_key($signing_key) { |
|
125 | 125 | $this->signing_key = $signing_key; |
126 | 126 | } |
127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string $token Authorization token. |
134 | 134 | * @param object|null $object Object. |
135 | 135 | */ |
136 | - private function request( $method, $endpoint, $token, $object = null ) { |
|
136 | + private function request($method, $endpoint, $token, $object = null) { |
|
137 | 137 | // URL. |
138 | 138 | $url = $this->get_url() . $endpoint; |
139 | 139 | |
@@ -145,45 +145,45 @@ discard block |
||
145 | 145 | ), |
146 | 146 | ); |
147 | 147 | |
148 | - if ( null !== $object ) { |
|
148 | + if (null !== $object) { |
|
149 | 149 | $args['headers']['Content-Type'] = 'application/json'; |
150 | 150 | |
151 | - $args['body'] = wp_json_encode( $object ); |
|
151 | + $args['body'] = wp_json_encode($object); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | // Request. |
155 | - $response = wp_remote_request( $url, $args ); |
|
155 | + $response = wp_remote_request($url, $args); |
|
156 | 156 | |
157 | - if ( $response instanceof WP_Error ) { |
|
157 | + if ($response instanceof WP_Error) { |
|
158 | 158 | $this->error = $response; |
159 | 159 | |
160 | - $this->error->add( 'omnikassa_2_error', 'HTTP Request Failed' ); |
|
160 | + $this->error->add('omnikassa_2_error', 'HTTP Request Failed'); |
|
161 | 161 | |
162 | 162 | return false; |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Body. |
166 | - $body = wp_remote_retrieve_body( $response ); |
|
166 | + $body = wp_remote_retrieve_body($response); |
|
167 | 167 | |
168 | - $data = json_decode( $body ); |
|
168 | + $data = json_decode($body); |
|
169 | 169 | |
170 | - if ( ! is_object( $data ) ) { |
|
171 | - $this->error = new WP_Error( 'omnikassa_2_error', 'Could not parse response.', $data ); |
|
170 | + if ( ! is_object($data)) { |
|
171 | + $this->error = new WP_Error('omnikassa_2_error', 'Could not parse response.', $data); |
|
172 | 172 | |
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
176 | 176 | // Error. |
177 | - if ( isset( $data->errorCode ) ) { |
|
177 | + if (isset($data->errorCode)) { |
|
178 | 178 | $message = 'Unknown error.'; |
179 | 179 | |
180 | - if ( isset( $data->consumerMessage ) ) { |
|
180 | + if (isset($data->consumerMessage)) { |
|
181 | 181 | $message = $data->consumerMessage; |
182 | - } elseif ( isset( $data->errorMessage ) ) { |
|
182 | + } elseif (isset($data->errorMessage)) { |
|
183 | 183 | $message = $data->errorMessage; |
184 | 184 | } |
185 | 185 | |
186 | - $this->error = new WP_Error( 'omnikassa_2_error', $message, $data ); |
|
186 | + $this->error = new WP_Error('omnikassa_2_error', $message, $data); |
|
187 | 187 | |
188 | 188 | return false; |
189 | 189 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return object|false |
199 | 199 | */ |
200 | 200 | public function get_access_token_data() { |
201 | - return $this->request( 'GET', 'gatekeeper/refresh', $this->get_refresh_token() ); |
|
201 | + return $this->request('GET', 'gatekeeper/refresh', $this->get_refresh_token()); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | * @param Order $order Order. |
209 | 209 | * @return object|bool |
210 | 210 | */ |
211 | - public function order_announce( $config, Order $order ) { |
|
211 | + public function order_announce($config, Order $order) { |
|
212 | 212 | $object = $order->get_json(); |
213 | 213 | |
214 | - $object->signature = Security::get_signature( $order, $config->signing_key ); |
|
214 | + $object->signature = Security::get_signature($order, $config->signing_key); |
|
215 | 215 | |
216 | - return $this->request( 'POST', 'order/server/api/order', $config->access_token, $object ); |
|
216 | + return $this->request('POST', 'order/server/api/order', $config->access_token, $object); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return OrderResults|false |
225 | 225 | */ |
226 | - public function get_order_results( $notification_token ) { |
|
227 | - $result = $this->request( 'GET', 'order/server/api/events/results/merchant.order.status.changed', $notification_token ); |
|
226 | + public function get_order_results($notification_token) { |
|
227 | + $result = $this->request('GET', 'order/server/api/events/results/merchant.order.status.changed', $notification_token); |
|
228 | 228 | |
229 | - if ( ! is_object( $result ) ) { |
|
229 | + if ( ! is_object($result)) { |
|
230 | 230 | return false; |
231 | 231 | } |
232 | 232 | |
233 | - return OrderResults::from_object( $result ); |
|
233 | + return OrderResults::from_object($result); |
|
234 | 234 | } |
235 | 235 | } |
@@ -25,26 +25,26 @@ discard block |
||
25 | 25 | * @param string $signing_key Signing Key. |
26 | 26 | * @return string|null |
27 | 27 | */ |
28 | - public static function get_signature( Signable $signable, $signing_key ) { |
|
28 | + public static function get_signature(Signable $signable, $signing_key) { |
|
29 | 29 | $data = $signable->get_signature_data(); |
30 | 30 | |
31 | - if ( empty( $data ) ) { |
|
31 | + if (empty($data)) { |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $signing_key ) ) { |
|
35 | + if (empty($signing_key)) { |
|
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | - $decoded_signing_key = base64_decode( $signing_key ); |
|
39 | + $decoded_signing_key = base64_decode($signing_key); |
|
40 | 40 | |
41 | - if ( false === $decoded_signing_key ) { |
|
41 | + if (false === $decoded_signing_key) { |
|
42 | 42 | return null; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $signature = hash_hmac( |
46 | 46 | 'sha512', |
47 | - implode( ',', $data ), |
|
47 | + implode(',', $data), |
|
48 | 48 | $decoded_signing_key |
49 | 49 | ); |
50 | 50 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * @param string $signature_b Signature B. |
59 | 59 | * @return bool True if valid, false otherwise. |
60 | 60 | */ |
61 | - public static function validate_signature( $signature_a, $signature_b ) { |
|
62 | - if ( empty( $signature_a ) || empty( $signature_b ) ) { |
|
61 | + public static function validate_signature($signature_a, $signature_b) { |
|
62 | + if (empty($signature_a) || empty($signature_b)) { |
|
63 | 63 | // Empty signature string or null from calculation. |
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | |
67 | - return ( 0 === strcasecmp( $signature_a, $signature_b ) ); |
|
67 | + return (0 === strcasecmp($signature_a, $signature_b)); |
|
68 | 68 | } |
69 | 69 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param string $signature Signature. |
41 | 41 | */ |
42 | - protected function set_signature( $signature ) { |
|
42 | + protected function set_signature($signature) { |
|
43 | 43 | $this->signature = $signature; |
44 | 44 | } |
45 | 45 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @param string $signing_key Signing key. |
50 | 50 | * @return bool True if valid, false otherwise. |
51 | 51 | */ |
52 | - public function is_valid( $signing_key ) { |
|
53 | - $signature = Security::get_signature( $this, $signing_key ); |
|
52 | + public function is_valid($signing_key) { |
|
53 | + $signature = Security::get_signature($this, $signing_key); |
|
54 | 54 | |
55 | - if ( empty( $signature ) ) { |
|
55 | + if (empty($signature)) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | |
59 | - return Security::validate_signature( $signature, $this->get_signature() ); |
|
59 | + return Security::validate_signature($signature, $this->get_signature()); |
|
60 | 60 | } |
61 | 61 | } |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | * Listen to OmniKassa 2.0 webhook requests. |
26 | 26 | */ |
27 | 27 | public static function listen() { |
28 | - if ( ! filter_has_var( INPUT_GET, 'omnikassa2_webhook' ) ) { |
|
28 | + if ( ! filter_has_var(INPUT_GET, 'omnikassa2_webhook')) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - $json = file_get_contents( 'php://input' ); |
|
32 | + $json = file_get_contents('php://input'); |
|
33 | 33 | |
34 | - if ( false === $json ) { |
|
34 | + if (false === $json) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | - $notification = Notification::from_json( $json ); |
|
38 | + $notification = Notification::from_json($json); |
|
39 | 39 | |
40 | 40 | $query = new \WP_Query( |
41 | 41 | array( |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | ) |
52 | 52 | ); |
53 | 53 | |
54 | - foreach ( $query->posts as $post ) { |
|
55 | - $gateway = Plugin::get_gateway( $post->ID ); |
|
54 | + foreach ($query->posts as $post) { |
|
55 | + $gateway = Plugin::get_gateway($post->ID); |
|
56 | 56 | |
57 | - if ( $gateway instanceof Gateway ) { |
|
58 | - $gateway->handle_notification( $notification ); |
|
57 | + if ($gateway instanceof Gateway) { |
|
58 | + $gateway->handle_notification($notification); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param Money $paid_amount Paid amount. |
96 | 96 | * @param Money $total_amount Total amount. |
97 | 97 | */ |
98 | - public function __construct( $merchant_order_id, $omnikassa_order_id, $poi_id, $order_status, $order_status_datetime, $error_code, Money $paid_amount, Money $total_amount ) { |
|
98 | + public function __construct($merchant_order_id, $omnikassa_order_id, $poi_id, $order_status, $order_status_datetime, $error_code, Money $paid_amount, Money $total_amount) { |
|
99 | 99 | $this->merchant_order_id = $merchant_order_id; |
100 | 100 | $this->omnikassa_order_id = $omnikassa_order_id; |
101 | 101 | $this->poi_id = $poi_id; |
@@ -203,37 +203,37 @@ discard block |
||
203 | 203 | * @return OrderResult |
204 | 204 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
205 | 205 | */ |
206 | - public static function from_object( stdClass $object ) { |
|
207 | - if ( ! isset( $object->merchantOrderId ) ) { |
|
208 | - throw new InvalidArgumentException( 'Object must contain `merchantOrderId` property.' ); |
|
206 | + public static function from_object(stdClass $object) { |
|
207 | + if ( ! isset($object->merchantOrderId)) { |
|
208 | + throw new InvalidArgumentException('Object must contain `merchantOrderId` property.'); |
|
209 | 209 | } |
210 | 210 | |
211 | - if ( ! isset( $object->omnikassaOrderId ) ) { |
|
212 | - throw new InvalidArgumentException( 'Object must contain `omnikassaOrderId` property.' ); |
|
211 | + if ( ! isset($object->omnikassaOrderId)) { |
|
212 | + throw new InvalidArgumentException('Object must contain `omnikassaOrderId` property.'); |
|
213 | 213 | } |
214 | 214 | |
215 | - if ( ! isset( $object->poiId ) ) { |
|
216 | - throw new InvalidArgumentException( 'Object must contain `poiId` property.' ); |
|
215 | + if ( ! isset($object->poiId)) { |
|
216 | + throw new InvalidArgumentException('Object must contain `poiId` property.'); |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( ! isset( $object->orderStatus ) ) { |
|
220 | - throw new InvalidArgumentException( 'Object must contain `orderStatus` property.' ); |
|
219 | + if ( ! isset($object->orderStatus)) { |
|
220 | + throw new InvalidArgumentException('Object must contain `orderStatus` property.'); |
|
221 | 221 | } |
222 | 222 | |
223 | - if ( ! isset( $object->orderStatusDateTime ) ) { |
|
224 | - throw new InvalidArgumentException( 'Object must contain `orderStatusDateTime` property.' ); |
|
223 | + if ( ! isset($object->orderStatusDateTime)) { |
|
224 | + throw new InvalidArgumentException('Object must contain `orderStatusDateTime` property.'); |
|
225 | 225 | } |
226 | 226 | |
227 | - if ( ! isset( $object->errorCode ) ) { |
|
228 | - throw new InvalidArgumentException( 'Object must contain `errorCode` property.' ); |
|
227 | + if ( ! isset($object->errorCode)) { |
|
228 | + throw new InvalidArgumentException('Object must contain `errorCode` property.'); |
|
229 | 229 | } |
230 | 230 | |
231 | - if ( ! isset( $object->paidAmount ) ) { |
|
232 | - throw new InvalidArgumentException( 'Object must contain `paidAmount` property.' ); |
|
231 | + if ( ! isset($object->paidAmount)) { |
|
232 | + throw new InvalidArgumentException('Object must contain `paidAmount` property.'); |
|
233 | 233 | } |
234 | 234 | |
235 | - if ( ! isset( $object->totalAmount ) ) { |
|
236 | - throw new InvalidArgumentException( 'Object must contain `totalAmount` property.' ); |
|
235 | + if ( ! isset($object->totalAmount)) { |
|
236 | + throw new InvalidArgumentException('Object must contain `totalAmount` property.'); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return new self( |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | $object->orderStatus, |
244 | 244 | $object->orderStatusDateTime, |
245 | 245 | $object->errorCode, |
246 | - Money::from_object( $object->paidAmount ), |
|
247 | - Money::from_object( $object->totalAmount ) |
|
246 | + Money::from_object($object->paidAmount), |
|
247 | + Money::from_object($object->totalAmount) |
|
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
@@ -255,19 +255,19 @@ discard block |
||
255 | 255 | * @return OrderResult |
256 | 256 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
257 | 257 | */ |
258 | - public static function from_json( $json ) { |
|
259 | - $data = json_decode( $json ); |
|
258 | + public static function from_json($json) { |
|
259 | + $data = json_decode($json); |
|
260 | 260 | |
261 | 261 | $validator = new Validator(); |
262 | 262 | |
263 | 263 | $validator->validate( |
264 | 264 | $data, |
265 | 265 | (object) array( |
266 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-order-result.json' ), |
|
266 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-order-result.json'), |
|
267 | 267 | ), |
268 | 268 | Constraint::CHECK_MODE_EXCEPTIONS |
269 | 269 | ); |
270 | 270 | |
271 | - return self::from_object( $data ); |
|
271 | + return self::from_object($data); |
|
272 | 272 | } |
273 | 273 | } |