Mollie Payments for WooCommerce - Version 5.0.7

Version Description

  • 04-12-2018 =

  • Fix - Bancontact payments don't return a name as part of IBAN details (in Mollie API), so in that case use the WooCommerce name

  • Fix - WooCommerce 2.6 and older: use get_country instead of get_billing_country

  • Fix - Remove calls to delete payment mode, renewal payments can't use a different mode anyway, mandates aren't shared between modes

  • Fix - Subscription renewal payments: if subscription does not contain the payment mode, try getting it from the parent order

  • Fix - For shipping details use !empty() instead of isset

  • Fix - Further improve restore_mollie_customer_id so it catches more edge-cases (and rename to restore_mollie_customer_id_and_mandate)

  • Fix - Remove delete meta calls for meta that wasn't used anywhere (mollie_card4_digits)

Download this release

Release Info

Developer davdebcom
Plugin Icon wp plugin Mollie Payments for WooCommerce
Version 5.0.7
Comparing to
See all releases

Code changes from version 5.0.6 to 5.0.7

Files changed (34) hide show
  1. includes/mollie-api-php/composer.lock +64 -22
  2. includes/mollie-api-php/vendor/composer/autoload_files.php +1 -0
  3. includes/mollie-api-php/vendor/composer/autoload_static.php +1 -0
  4. includes/mollie-api-php/vendor/composer/installed.json +53 -9
  5. includes/mollie-api-php/vendor/guzzlehttp/psr7/.editorconfig +9 -0
  6. includes/mollie-api-php/vendor/guzzlehttp/psr7/CHANGELOG.md +157 -58
  7. includes/mollie-api-php/vendor/guzzlehttp/psr7/README.md +7 -1
  8. includes/mollie-api-php/vendor/guzzlehttp/psr7/composer.json +10 -4
  9. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/AppendStream.php +12 -4
  10. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/FnStream.php +9 -0
  11. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/InflateStream.php +1 -1
  12. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Request.php +2 -2
  13. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Response.php +4 -0
  14. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Rfc7230.php +18 -0
  15. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/ServerRequest.php +25 -7
  16. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Stream.php +26 -13
  17. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/StreamWrapper.php +43 -3
  18. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Uri.php +62 -26
  19. includes/mollie-api-php/vendor/guzzlehttp/psr7/src/functions.php +95 -30
  20. includes/mollie-api-php/vendor/ralouphie/getallheaders/.gitignore +5 -0
  21. includes/mollie-api-php/vendor/ralouphie/getallheaders/.travis.yml +18 -0
  22. includes/mollie-api-php/vendor/ralouphie/getallheaders/LICENSE +21 -0
  23. includes/mollie-api-php/vendor/ralouphie/getallheaders/README.md +19 -0
  24. includes/mollie-api-php/vendor/ralouphie/getallheaders/composer.json +21 -0
  25. includes/mollie-api-php/vendor/ralouphie/getallheaders/phpunit.xml +22 -0
  26. includes/mollie-api-php/vendor/ralouphie/getallheaders/src/getallheaders.php +46 -0
  27. includes/mollie-api-php/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php +121 -0
  28. includes/mollie/wc/gateway/abstract.php +3 -1
  29. includes/mollie/wc/gateway/abstractsubscription.php +69 -34
  30. includes/mollie/wc/payment/order.php +19 -1
  31. includes/mollie/wc/payment/payment.php +17 -0
  32. includes/mollie/wc/plugin.php +1 -1
  33. mollie-payments-for-woocommerce.php +1 -1
  34. readme.txt +12 -2
includes/mollie-api-php/composer.lock CHANGED
@@ -180,32 +180,33 @@
180
  },
181
  {
182
  "name": "guzzlehttp/psr7",
183
- "version": "1.4.2",
184
  "source": {
185
  "type": "git",
186
  "url": "https://github.com/guzzle/psr7.git",
187
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
188
  },
189
  "dist": {
190
  "type": "zip",
191
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
192
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
193
  "shasum": ""
194
  },
195
  "require": {
196
  "php": ">=5.4.0",
197
- "psr/http-message": "~1.0"
 
198
  },
199
  "provide": {
200
  "psr/http-message-implementation": "1.0"
201
  },
202
  "require-dev": {
203
- "phpunit/phpunit": "~4.0"
204
  },
205
  "type": "library",
206
  "extra": {
207
  "branch-alias": {
208
- "dev-master": "1.4-dev"
209
  }
210
  },
211
  "autoload": {
@@ -235,13 +236,14 @@
235
  "keywords": [
236
  "http",
237
  "message",
 
238
  "request",
239
  "response",
240
  "stream",
241
  "uri",
242
  "url"
243
  ],
244
- "time": "2017-03-20T17:10:46+00:00"
245
  },
246
  {
247
  "name": "psr/http-message",
@@ -292,6 +294,46 @@
292
  "response"
293
  ],
294
  "time": "2016-08-06T14:39:51+00:00"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
296
  ],
297
  "packages-dev": [
@@ -1066,16 +1108,16 @@
1066
  },
1067
  {
1068
  "name": "phpunit/phpunit",
1069
- "version": "7.4.3",
1070
  "source": {
1071
  "type": "git",
1072
  "url": "https://github.com/sebastianbergmann/phpunit.git",
1073
- "reference": "c151651fb6ed264038d486ea262e243af72e5e64"
1074
  },
1075
  "dist": {
1076
  "type": "zip",
1077
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c151651fb6ed264038d486ea262e243af72e5e64",
1078
- "reference": "c151651fb6ed264038d486ea262e243af72e5e64",
1079
  "shasum": ""
1080
  },
1081
  "require": {
@@ -1096,7 +1138,7 @@
1096
  "phpunit/php-timer": "^2.0",
1097
  "sebastian/comparator": "^3.0",
1098
  "sebastian/diff": "^3.0",
1099
- "sebastian/environment": "^3.1 || ^4.0",
1100
  "sebastian/exporter": "^3.1",
1101
  "sebastian/global-state": "^2.0",
1102
  "sebastian/object-enumerator": "^3.0.3",
@@ -1146,7 +1188,7 @@
1146
  "testing",
1147
  "xunit"
1148
  ],
1149
- "time": "2018-10-23T05:57:41+00:00"
1150
  },
1151
  {
1152
  "name": "sebastian/code-unit-reverse-lookup",
@@ -1315,28 +1357,28 @@
1315
  },
1316
  {
1317
  "name": "sebastian/environment",
1318
- "version": "3.1.0",
1319
  "source": {
1320
  "type": "git",
1321
  "url": "https://github.com/sebastianbergmann/environment.git",
1322
- "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5"
1323
  },
1324
  "dist": {
1325
  "type": "zip",
1326
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5",
1327
- "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5",
1328
  "shasum": ""
1329
  },
1330
  "require": {
1331
- "php": "^7.0"
1332
  },
1333
  "require-dev": {
1334
- "phpunit/phpunit": "^6.1"
1335
  },
1336
  "type": "library",
1337
  "extra": {
1338
  "branch-alias": {
1339
- "dev-master": "3.1.x-dev"
1340
  }
1341
  },
1342
  "autoload": {
@@ -1361,7 +1403,7 @@
1361
  "environment",
1362
  "hhvm"
1363
  ],
1364
- "time": "2017-07-01T08:51:00+00:00"
1365
  },
1366
  {
1367
  "name": "sebastian/exporter",
180
  },
181
  {
182
  "name": "guzzlehttp/psr7",
183
+ "version": "1.5.0",
184
  "source": {
185
  "type": "git",
186
  "url": "https://github.com/guzzle/psr7.git",
187
+ "reference": "53662d6688033a5eccde987bdd5a4a98ebe2d952"
188
  },
189
  "dist": {
190
  "type": "zip",
191
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/53662d6688033a5eccde987bdd5a4a98ebe2d952",
192
+ "reference": "53662d6688033a5eccde987bdd5a4a98ebe2d952",
193
  "shasum": ""
194
  },
195
  "require": {
196
  "php": ">=5.4.0",
197
+ "psr/http-message": "~1.0",
198
+ "ralouphie/getallheaders": "^2.0.5"
199
  },
200
  "provide": {
201
  "psr/http-message-implementation": "1.0"
202
  },
203
  "require-dev": {
204
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
205
  },
206
  "type": "library",
207
  "extra": {
208
  "branch-alias": {
209
+ "dev-master": "1.5-dev"
210
  }
211
  },
212
  "autoload": {
236
  "keywords": [
237
  "http",
238
  "message",
239
+ "psr-7",
240
  "request",
241
  "response",
242
  "stream",
243
  "uri",
244
  "url"
245
  ],
246
+ "time": "2018-12-03T05:07:51+00:00"
247
  },
248
  {
249
  "name": "psr/http-message",
294
  "response"
295
  ],
296
  "time": "2016-08-06T14:39:51+00:00"
297
+ },
298
+ {
299
+ "name": "ralouphie/getallheaders",
300
+ "version": "2.0.5",
301
+ "source": {
302
+ "type": "git",
303
+ "url": "https://github.com/ralouphie/getallheaders.git",
304
+ "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa"
305
+ },
306
+ "dist": {
307
+ "type": "zip",
308
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
309
+ "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
310
+ "shasum": ""
311
+ },
312
+ "require": {
313
+ "php": ">=5.3"
314
+ },
315
+ "require-dev": {
316
+ "phpunit/phpunit": "~3.7.0",
317
+ "satooshi/php-coveralls": ">=1.0"
318
+ },
319
+ "type": "library",
320
+ "autoload": {
321
+ "files": [
322
+ "src/getallheaders.php"
323
+ ]
324
+ },
325
+ "notification-url": "https://packagist.org/downloads/",
326
+ "license": [
327
+ "MIT"
328
+ ],
329
+ "authors": [
330
+ {
331
+ "name": "Ralph Khattar",
332
+ "email": "ralph.khattar@gmail.com"
333
+ }
334
+ ],
335
+ "description": "A polyfill for getallheaders.",
336
+ "time": "2016-02-11T07:05:27+00:00"
337
  }
338
  ],
339
  "packages-dev": [
1108
  },
1109
  {
1110
  "name": "phpunit/phpunit",
1111
+ "version": "7.4.5",
1112
  "source": {
1113
  "type": "git",
1114
  "url": "https://github.com/sebastianbergmann/phpunit.git",
1115
+ "reference": "61d34e8dd6eb3555900f0f2a2fa9e7e570730102"
1116
  },
1117
  "dist": {
1118
  "type": "zip",
1119
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/61d34e8dd6eb3555900f0f2a2fa9e7e570730102",
1120
+ "reference": "61d34e8dd6eb3555900f0f2a2fa9e7e570730102",
1121
  "shasum": ""
1122
  },
1123
  "require": {
1138
  "phpunit/php-timer": "^2.0",
1139
  "sebastian/comparator": "^3.0",
1140
  "sebastian/diff": "^3.0",
1141
+ "sebastian/environment": "^4.0",
1142
  "sebastian/exporter": "^3.1",
1143
  "sebastian/global-state": "^2.0",
1144
  "sebastian/object-enumerator": "^3.0.3",
1188
  "testing",
1189
  "xunit"
1190
  ],
1191
+ "time": "2018-12-03T05:01:24+00:00"
1192
  },
1193
  {
1194
  "name": "sebastian/code-unit-reverse-lookup",
1357
  },
1358
  {
1359
  "name": "sebastian/environment",
1360
+ "version": "4.0.1",
1361
  "source": {
1362
  "type": "git",
1363
  "url": "https://github.com/sebastianbergmann/environment.git",
1364
+ "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f"
1365
  },
1366
  "dist": {
1367
  "type": "zip",
1368
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/febd209a219cea7b56ad799b30ebbea34b71eb8f",
1369
+ "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f",
1370
  "shasum": ""
1371
  },
1372
  "require": {
1373
+ "php": "^7.1"
1374
  },
1375
  "require-dev": {
1376
+ "phpunit/phpunit": "^7.4"
1377
  },
1378
  "type": "library",
1379
  "extra": {
1380
  "branch-alias": {
1381
+ "dev-master": "4.0-dev"
1382
  }
1383
  },
1384
  "autoload": {
1403
  "environment",
1404
  "hhvm"
1405
  ],
1406
+ "time": "2018-11-25T09:31:21+00:00"
1407
  },
1408
  {
1409
  "name": "sebastian/exporter",
includes/mollie-api-php/vendor/composer/autoload_files.php CHANGED
@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
10
  'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
11
  '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
10
  'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
11
  'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
12
  '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
includes/mollie-api-php/vendor/composer/autoload_static.php CHANGED
@@ -7,6 +7,7 @@ namespace Composer\Autoload;
7
  class ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8
8
  {
9
  public static $files = array (
 
10
  'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
11
  'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
12
  '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
7
  class ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8
8
  {
9
  public static $files = array (
10
+ '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
11
  'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
12
  'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
13
  '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
includes/mollie-api-php/vendor/composer/installed.json CHANGED
@@ -179,34 +179,35 @@
179
  },
180
  {
181
  "name": "guzzlehttp/psr7",
182
- "version": "1.4.2",
183
- "version_normalized": "1.4.2.0",
184
  "source": {
185
  "type": "git",
186
  "url": "https://github.com/guzzle/psr7.git",
187
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
188
  },
189
  "dist": {
190
  "type": "zip",
191
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
192
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
193
  "shasum": ""
194
  },
195
  "require": {
196
  "php": ">=5.4.0",
197
- "psr/http-message": "~1.0"
 
198
  },
199
  "provide": {
200
  "psr/http-message-implementation": "1.0"
201
  },
202
  "require-dev": {
203
- "phpunit/phpunit": "~4.0"
204
  },
205
- "time": "2017-03-20T17:10:46+00:00",
206
  "type": "library",
207
  "extra": {
208
  "branch-alias": {
209
- "dev-master": "1.4-dev"
210
  }
211
  },
212
  "installation-source": "dist",
@@ -237,6 +238,7 @@
237
  "keywords": [
238
  "http",
239
  "message",
 
240
  "request",
241
  "response",
242
  "stream",
@@ -295,5 +297,47 @@
295
  "request",
296
  "response"
297
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
  ]
179
  },
180
  {
181
  "name": "guzzlehttp/psr7",
182
+ "version": "1.5.0",
183
+ "version_normalized": "1.5.0.0",
184
  "source": {
185
  "type": "git",
186
  "url": "https://github.com/guzzle/psr7.git",
187
+ "reference": "53662d6688033a5eccde987bdd5a4a98ebe2d952"
188
  },
189
  "dist": {
190
  "type": "zip",
191
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/53662d6688033a5eccde987bdd5a4a98ebe2d952",
192
+ "reference": "53662d6688033a5eccde987bdd5a4a98ebe2d952",
193
  "shasum": ""
194
  },
195
  "require": {
196
  "php": ">=5.4.0",
197
+ "psr/http-message": "~1.0",
198
+ "ralouphie/getallheaders": "^2.0.5"
199
  },
200
  "provide": {
201
  "psr/http-message-implementation": "1.0"
202
  },
203
  "require-dev": {
204
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
205
  },
206
+ "time": "2018-12-03T05:07:51+00:00",
207
  "type": "library",
208
  "extra": {
209
  "branch-alias": {
210
+ "dev-master": "1.5-dev"
211
  }
212
  },
213
  "installation-source": "dist",
238
  "keywords": [
239
  "http",
240
  "message",
241
+ "psr-7",
242
  "request",
243
  "response",
244
  "stream",
297
  "request",
298
  "response"
299
  ]
300
+ },
301
+ {
302
+ "name": "ralouphie/getallheaders",
303
+ "version": "2.0.5",
304
+ "version_normalized": "2.0.5.0",
305
+ "source": {
306
+ "type": "git",
307
+ "url": "https://github.com/ralouphie/getallheaders.git",
308
+ "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa"
309
+ },
310
+ "dist": {
311
+ "type": "zip",
312
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
313
+ "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
314
+ "shasum": ""
315
+ },
316
+ "require": {
317
+ "php": ">=5.3"
318
+ },
319
+ "require-dev": {
320
+ "phpunit/phpunit": "~3.7.0",
321
+ "satooshi/php-coveralls": ">=1.0"
322
+ },
323
+ "time": "2016-02-11T07:05:27+00:00",
324
+ "type": "library",
325
+ "installation-source": "dist",
326
+ "autoload": {
327
+ "files": [
328
+ "src/getallheaders.php"
329
+ ]
330
+ },
331
+ "notification-url": "https://packagist.org/downloads/",
332
+ "license": [
333
+ "MIT"
334
+ ],
335
+ "authors": [
336
+ {
337
+ "name": "Ralph Khattar",
338
+ "email": "ralph.khattar@gmail.com"
339
+ }
340
+ ],
341
+ "description": "A polyfill for getallheaders."
342
  }
343
  ]
includes/mollie-api-php/vendor/guzzlehttp/psr7/.editorconfig ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 4
7
+ indent_style = space
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
includes/mollie-api-php/vendor/guzzlehttp/psr7/CHANGELOG.md CHANGED
@@ -1,32 +1,68 @@
1
- # CHANGELOG
2
 
3
- ## 1.4.2 - 2017-03-20
4
 
5
- * Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  calls to `trigger_error` when deprecated methods are invoked.
7
 
8
- ## 1.4.1 - 2017-02-27
9
 
10
- * Reverted BC break by reintroducing behavior to automagically fix a URI with a
 
 
 
 
 
 
 
 
11
  relative path and an authority by adding a leading slash to the path. It's only
12
  deprecated now.
13
- * Added triggering of silenced deprecation warnings.
14
 
15
- ## 1.4.0 - 2017-02-21
16
 
17
- * Fix `Stream::read` when length parameter <= 0.
18
- * `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
19
- * Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port.
20
- * Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
21
- * Allow `parse_response` to parse a response without delimiting space and reason.
22
- * Ensure each URI modification results in a valid URI according to PSR-7 discussions.
23
- Invalid modifications will throw an exception instead of returning a wrong URI or
24
- doing some magic.
25
- - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
26
- because the path of a URI with an authority must start with a slash "/" or be empty
27
- - `(new Uri())->withScheme('http')` will return `'http://localhost'`
28
- * Fix compatibility of URIs with `file` scheme and empty host.
29
- * Added common URI utility methods based on RFC 3986 (see documentation in the readme):
30
  - `Uri::isDefaultPort`
31
  - `Uri::isAbsolute`
32
  - `Uri::isNetworkPathReference`
@@ -37,69 +73,117 @@
37
  - `UriNormalizer::normalize`
38
  - `UriNormalizer::isEquivalent`
39
  - `UriResolver::relativize`
40
- * Deprecated `Uri::resolve` in favor of `UriResolver::resolve`
41
- * Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
42
 
43
- ## 1.3.1 - 2016-06-25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- * Fix `Uri::__toString` for network path references, e.g. `//example.org`.
46
- * Fix missing lowercase normalization for host.
47
- * Fix handling of URI components in case they are `'0'` in a lot of places,
 
 
 
 
 
 
 
 
 
 
48
  e.g. as a user info password.
49
- * Fix `Uri::withAddedHeader` to correctly merge headers with different case.
50
- * Fix trimming of header values in `Uri::withAddedHeader`. Header values may
51
  be surrounded by whitespace which should be ignored according to RFC 7230
52
  Section 3.2.4. This does not apply to header names.
53
- * Fix `Uri::withAddedHeader` with an array of header values.
54
- * Fix `Uri::resolve` when base path has no slash and handling of fragment.
55
- * Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
56
  key/value both in encoded as well as decoded form to those methods. This is
57
  consistent with withPath, withQuery etc.
58
- * Fix `ServerRequest::withoutAttribute` when attribute value is null.
59
 
60
- ## 1.3.0 - 2016-04-13
61
 
62
- * Added remaining interfaces needed for full PSR7 compatibility
 
 
 
 
63
  (ServerRequestInterface, UploadedFileInterface, etc.).
64
- * Added support for stream_for from scalars.
65
- * Can now extend Uri.
66
- * Fixed a bug in validating request methods by making it more permissive.
 
 
67
 
68
- ## 1.2.3 - 2016-02-18
 
69
 
70
- * Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
 
 
 
 
 
71
  streams, which can sometimes return fewer bytes than requested with `fread`.
72
- * Fixed handling of gzipped responses with FNAME headers.
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- ## 1.2.2 - 2016-01-22
75
 
76
- * Added support for URIs without any authority.
77
- * Added support for HTTP 451 'Unavailable For Legal Reasons.'
78
- * Added support for using '0' as a filename.
79
- * Added support for including non-standard ports in Host headers.
80
 
81
- ## 1.2.1 - 2015-11-02
82
 
83
- * Now supporting negative offsets when seeking to SEEK_END.
84
 
85
- ## 1.2.0 - 2015-08-15
86
 
87
- * Body as `"0"` is now properly added to a response.
88
- * Now allowing forward seeking in CachingStream.
89
- * Now properly parsing HTTP requests that contain proxy targets in
 
 
90
  `parse_request`.
91
- * functions.php is now conditionally required.
92
- * user-info is no longer dropped when resolving URIs.
 
93
 
94
- ## 1.1.0 - 2015-06-24
95
 
96
- * URIs can now be relative.
97
- * `multipart/form-data` headers are now overridden case-insensitively.
98
- * URI paths no longer encode the following characters because they are allowed
 
 
99
  in URIs: "(", ")", "*", "!", "'"
100
- * A port is no longer added to a URI when the scheme is missing and no port is
101
  present.
102
 
 
103
  ## 1.0.0 - 2015-05-19
104
 
105
  Initial release.
@@ -108,3 +192,18 @@ Currently unsupported:
108
 
109
  - `Psr\Http\Message\ServerRequestInterface`
110
  - `Psr\Http\Message\UploadedFileInterface`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
 
 
3
 
4
+ All notable changes to this project will be documented in this file.
5
+
6
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
7
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
8
+
9
+
10
+ ## [Unreleased]
11
+
12
+
13
+ ## [1.5.0] - 2018-12-03
14
+
15
+ ### Added
16
+
17
+ - Response first-line to response string exception (fixes #145)
18
+ - A test for #129 behavior
19
+ - `get_message_body_summary` function in order to get the message summary
20
+ - `3gp` and `mkv` mime types
21
+
22
+ ### Changed
23
+
24
+ - Clarify exception message when stream is detached
25
+
26
+ ### Deprecated
27
+
28
+ - Deprecated parsing folded header lines as per RFC 7230
29
+
30
+ ### Fixed
31
+
32
+ - Fix `AppendStream::detach` to not close streams
33
+ - `InflateStream` preserves `isSeekable` attribute of the underlying stream
34
+ - `ServerRequest::getUriFromGlobals` to support URLs in query parameters
35
+
36
+
37
+ Several other fixes and improvements.
38
+
39
+
40
+ ## [1.4.2] - 2017-03-20
41
+
42
+ ### Fixed
43
+
44
+ - Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
45
  calls to `trigger_error` when deprecated methods are invoked.
46
 
 
47
 
48
+ ## [1.4.1] - 2017-02-27
49
+
50
+ ### Added
51
+
52
+ - Rriggering of silenced deprecation warnings.
53
+
54
+ ### Fixed
55
+
56
+ - Reverted BC break by reintroducing behavior to automagically fix a URI with a
57
  relative path and an authority by adding a leading slash to the path. It's only
58
  deprecated now.
 
59
 
 
60
 
61
+ ## [1.4.0] - 2017-02-21
62
+
63
+ ### Added
64
+
65
+ - Added common URI utility methods based on RFC 3986 (see documentation in the readme):
 
 
 
 
 
 
 
 
66
  - `Uri::isDefaultPort`
67
  - `Uri::isAbsolute`
68
  - `Uri::isNetworkPathReference`
73
  - `UriNormalizer::normalize`
74
  - `UriNormalizer::isEquivalent`
75
  - `UriResolver::relativize`
 
 
76
 
77
+ ### Changed
78
+
79
+ - Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
80
+ - Allow `parse_response` to parse a response without delimiting space and reason.
81
+ - Ensure each URI modification results in a valid URI according to PSR-7 discussions.
82
+ Invalid modifications will throw an exception instead of returning a wrong URI or
83
+ doing some magic.
84
+ - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
85
+ because the path of a URI with an authority must start with a slash "/" or be empty
86
+ - `(new Uri())->withScheme('http')` will return `'http://localhost'`
87
+
88
+ ### Deprecated
89
+
90
+ - `Uri::resolve` in favor of `UriResolver::resolve`
91
+ - `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
92
+
93
+ ### Fixed
94
 
95
+ - `Stream::read` when length parameter <= 0.
96
+ - `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
97
+ - `ServerRequest::getUriFromGlobals` when `Host` header contains port.
98
+ - Compatibility of URIs with `file` scheme and empty host.
99
+
100
+
101
+ ## [1.3.1] - 2016-06-25
102
+
103
+ ### Fixed
104
+
105
+ - `Uri::__toString` for network path references, e.g. `//example.org`.
106
+ - Missing lowercase normalization for host.
107
+ - Handling of URI components in case they are `'0'` in a lot of places,
108
  e.g. as a user info password.
109
+ - `Uri::withAddedHeader` to correctly merge headers with different case.
110
+ - Trimming of header values in `Uri::withAddedHeader`. Header values may
111
  be surrounded by whitespace which should be ignored according to RFC 7230
112
  Section 3.2.4. This does not apply to header names.
113
+ - `Uri::withAddedHeader` with an array of header values.
114
+ - `Uri::resolve` when base path has no slash and handling of fragment.
115
+ - Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
116
  key/value both in encoded as well as decoded form to those methods. This is
117
  consistent with withPath, withQuery etc.
118
+ - `ServerRequest::withoutAttribute` when attribute value is null.
119
 
 
120
 
121
+ ## [1.3.0] - 2016-04-13
122
+
123
+ ### Added
124
+
125
+ - Remaining interfaces needed for full PSR7 compatibility
126
  (ServerRequestInterface, UploadedFileInterface, etc.).
127
+ - Support for stream_for from scalars.
128
+
129
+ ### Changed
130
+
131
+ - Can now extend Uri.
132
 
133
+ ### Fixed
134
+ - A bug in validating request methods by making it more permissive.
135
 
136
+
137
+ ## [1.2.3] - 2016-02-18
138
+
139
+ ### Fixed
140
+
141
+ - Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
142
  streams, which can sometimes return fewer bytes than requested with `fread`.
143
+ - Handling of gzipped responses with FNAME headers.
144
+
145
+
146
+ ## [1.2.2] - 2016-01-22
147
+
148
+ ### Added
149
+
150
+ - Support for URIs without any authority.
151
+ - Support for HTTP 451 'Unavailable For Legal Reasons.'
152
+ - Support for using '0' as a filename.
153
+ - Support for including non-standard ports in Host headers.
154
+
155
 
156
+ ## [1.2.1] - 2015-11-02
157
 
158
+ ### Changes
 
 
 
159
 
160
+ - Now supporting negative offsets when seeking to SEEK_END.
161
 
 
162
 
163
+ ## [1.2.0] - 2015-08-15
164
 
165
+ ### Changed
166
+
167
+ - Body as `"0"` is now properly added to a response.
168
+ - Now allowing forward seeking in CachingStream.
169
+ - Now properly parsing HTTP requests that contain proxy targets in
170
  `parse_request`.
171
+ - functions.php is now conditionally required.
172
+ - user-info is no longer dropped when resolving URIs.
173
+
174
 
175
+ ## [1.1.0] - 2015-06-24
176
 
177
+ ### Changed
178
+
179
+ - URIs can now be relative.
180
+ - `multipart/form-data` headers are now overridden case-insensitively.
181
+ - URI paths no longer encode the following characters because they are allowed
182
  in URIs: "(", ")", "*", "!", "'"
183
+ - A port is no longer added to a URI when the scheme is missing and no port is
184
  present.
185
 
186
+
187
  ## 1.0.0 - 2015-05-19
188
 
189
  Initial release.
192
 
193
  - `Psr\Http\Message\ServerRequestInterface`
194
  - `Psr\Http\Message\UploadedFileInterface`
195
+
196
+
197
+
198
+ [Unreleased]: https://github.com/guzzle/psr7/compare/1.5.0...HEAD
199
+ [1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
200
+ [1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
201
+ [1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
202
+ [1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
203
+ [1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
204
+ [1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
205
+ [1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
206
+ [1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
207
+ [1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
208
+ [1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
209
+ [1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0
includes/mollie-api-php/vendor/guzzlehttp/psr7/README.md CHANGED
@@ -372,7 +372,7 @@ This method accepts the following `$resource` types:
372
  $stream = GuzzleHttp\Psr7\stream_for('foo');
373
  $stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r'));
374
 
375
- $generator function ($bytes) {
376
  for ($i = 0; $i < $bytes; $i++) {
377
  yield ' ';
378
  }
@@ -606,6 +606,12 @@ Creates a new URI with a specific query string value. Any existing query string
606
  provided key are removed and replaced with the given key value pair. A value of null will set the query string
607
  key without a value, e.g. "key" instead of "key=value".
608
 
 
 
 
 
 
 
609
 
610
  ### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
611
 
372
  $stream = GuzzleHttp\Psr7\stream_for('foo');
373
  $stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r'));
374
 
375
+ $generator = function ($bytes) {
376
  for ($i = 0; $i < $bytes; $i++) {
377
  yield ' ';
378
  }
606
  provided key are removed and replaced with the given key value pair. A value of null will set the query string
607
  key without a value, e.g. "key" instead of "key=value".
608
 
609
+ ### `GuzzleHttp\Psr7\Uri::withQueryValues`
610
+
611
+ `public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface`
612
+
613
+ Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an
614
+ associative array of key => value.
615
 
616
  ### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
617
 
includes/mollie-api-php/vendor/guzzlehttp/psr7/composer.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "guzzlehttp/psr7",
3
  "type": "library",
4
  "description": "PSR-7 message implementation that also provides common utility methods",
5
- "keywords": ["request", "response", "message", "stream", "http", "uri", "url"],
6
  "license": "MIT",
7
  "authors": [
8
  {
@@ -17,10 +17,11 @@
17
  ],
18
  "require": {
19
  "php": ">=5.4.0",
20
- "psr/http-message": "~1.0"
 
21
  },
22
  "require-dev": {
23
- "phpunit/phpunit": "~4.0"
24
  },
25
  "provide": {
26
  "psr/http-message-implementation": "1.0"
@@ -31,9 +32,14 @@
31
  },
32
  "files": ["src/functions_include.php"]
33
  },
 
 
 
 
 
34
  "extra": {
35
  "branch-alias": {
36
- "dev-master": "1.4-dev"
37
  }
38
  }
39
  }
2
  "name": "guzzlehttp/psr7",
3
  "type": "library",
4
  "description": "PSR-7 message implementation that also provides common utility methods",
5
+ "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
6
  "license": "MIT",
7
  "authors": [
8
  {
17
  ],
18
  "require": {
19
  "php": ">=5.4.0",
20
+ "psr/http-message": "~1.0",
21
+ "ralouphie/getallheaders": "^2.0.5"
22
  },
23
  "require-dev": {
24
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
25
  },
26
  "provide": {
27
  "psr/http-message-implementation": "1.0"
32
  },
33
  "files": ["src/functions_include.php"]
34
  },
35
+ "autoload-dev": {
36
+ "psr-4": {
37
+ "GuzzleHttp\\Tests\\Psr7\\": "tests/"
38
+ }
39
+ },
40
  "extra": {
41
  "branch-alias": {
42
+ "dev-master": "1.5-dev"
43
  }
44
  }
45
  }
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/AppendStream.php CHANGED
@@ -16,7 +16,6 @@ class AppendStream implements StreamInterface
16
  private $seekable = true;
17
  private $current = 0;
18
  private $pos = 0;
19
- private $detached = false;
20
 
21
  /**
22
  * @param StreamInterface[] $streams Streams to decorate. Each stream must
@@ -73,6 +72,7 @@ class AppendStream implements StreamInterface
73
  public function close()
74
  {
75
  $this->pos = $this->current = 0;
 
76
 
77
  foreach ($this->streams as $stream) {
78
  $stream->close();
@@ -82,14 +82,22 @@ class AppendStream implements StreamInterface
82
  }
83
 
84
  /**
85
- * Detaches each attached stream
 
 
86
  *
87
  * {@inheritdoc}
88
  */
89
  public function detach()
90
  {
91
- $this->close();
92
- $this->detached = true;
 
 
 
 
 
 
93
  }
94
 
95
  public function tell()
16
  private $seekable = true;
17
  private $current = 0;
18
  private $pos = 0;
 
19
 
20
  /**
21
  * @param StreamInterface[] $streams Streams to decorate. Each stream must
72
  public function close()
73
  {
74
  $this->pos = $this->current = 0;
75
+ $this->seekable = true;
76
 
77
  foreach ($this->streams as $stream) {
78
  $stream->close();
82
  }
83
 
84
  /**
85
+ * Detaches each attached stream.
86
+ *
87
+ * Returns null as it's not clear which underlying stream resource to return.
88
  *
89
  * {@inheritdoc}
90
  */
91
  public function detach()
92
  {
93
+ $this->pos = $this->current = 0;
94
+ $this->seekable = true;
95
+
96
+ foreach ($this->streams as $stream) {
97
+ $stream->detach();
98
+ }
99
+
100
+ $this->streams = [];
101
  }
102
 
103
  public function tell()
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/FnStream.php CHANGED
@@ -52,6 +52,15 @@ class FnStream implements StreamInterface
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Adds custom functionality to an underlying stream by intercepting
57
  * specific method calls.
52
  }
53
  }
54
 
55
+ /**
56
+ * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
57
+ * @throws \LogicException
58
+ */
59
+ public function __wakeup()
60
+ {
61
+ throw new \LogicException('FnStream should never be unserialized');
62
+ }
63
+
64
  /**
65
  * Adds custom functionality to an underlying stream by intercepting
66
  * specific method calls.
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/InflateStream.php CHANGED
@@ -27,7 +27,7 @@ class InflateStream implements StreamInterface
27
  $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
28
  $resource = StreamWrapper::getResource($stream);
29
  stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
30
- $this->stream = new Stream($resource);
31
  }
32
 
33
  /**
27
  $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
28
  $resource = StreamWrapper::getResource($stream);
29
  stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
30
+ $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
31
  }
32
 
33
  /**
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Request.php CHANGED
@@ -45,7 +45,7 @@ class Request implements RequestInterface
45
  $this->setHeaders($headers);
46
  $this->protocol = $version;
47
 
48
- if (!$this->hasHeader('Host')) {
49
  $this->updateHostFromUri();
50
  }
51
 
@@ -110,7 +110,7 @@ class Request implements RequestInterface
110
  $new = clone $this;
111
  $new->uri = $uri;
112
 
113
- if (!$preserveHost) {
114
  $new->updateHostFromUri();
115
  }
116
 
45
  $this->setHeaders($headers);
46
  $this->protocol = $version;
47
 
48
+ if (!isset($this->headerNames['host'])) {
49
  $this->updateHostFromUri();
50
  }
51
 
110
  $new = clone $this;
111
  $new->uri = $uri;
112
 
113
+ if (!$preserveHost || !isset($this->headerNames['host'])) {
114
  $new->updateHostFromUri();
115
  }
116
 
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Response.php CHANGED
@@ -93,6 +93,10 @@ class Response implements ResponseInterface
93
  $version = '1.1',
94
  $reason = null
95
  ) {
 
 
 
 
96
  $this->statusCode = (int) $status;
97
 
98
  if ($body !== '' && $body !== null) {
93
  $version = '1.1',
94
  $reason = null
95
  ) {
96
+ if (filter_var($status, FILTER_VALIDATE_INT) === false) {
97
+ throw new \InvalidArgumentException('Status code must be an integer value.');
98
+ }
99
+
100
  $this->statusCode = (int) $status;
101
 
102
  if ($body !== '' && $body !== null) {
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Rfc7230.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace GuzzleHttp\Psr7;
4
+
5
+ final class Rfc7230
6
+ {
7
+ /**
8
+ * Header related regular expressions (copied from amphp/http package)
9
+ * (Note: once we require PHP 7.x we could just depend on the upstream package)
10
+ *
11
+ * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons.
12
+ *
13
+ * @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
14
+ * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
15
+ */
16
+ const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
17
+ const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
18
+ }
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/ServerRequest.php CHANGED
@@ -166,7 +166,7 @@ class ServerRequest extends Request implements ServerRequestInterface
166
  public static function fromGlobals()
167
  {
168
  $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
169
- $headers = function_exists('getallheaders') ? getallheaders() : [];
170
  $uri = self::getUriFromGlobals();
171
  $body = new LazyOpenStream('php://input', 'r+');
172
  $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
@@ -180,23 +180,41 @@ class ServerRequest extends Request implements ServerRequestInterface
180
  ->withUploadedFiles(self::normalizeFiles($_FILES));
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  /**
184
  * Get a Uri populated with values from $_SERVER.
185
  *
186
  * @return UriInterface
187
  */
188
- public static function getUriFromGlobals() {
 
189
  $uri = new Uri('');
190
 
191
  $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
192
 
193
  $hasPort = false;
194
  if (isset($_SERVER['HTTP_HOST'])) {
195
- $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']);
196
- $uri = $uri->withHost($hostHeaderParts[0]);
197
- if (isset($hostHeaderParts[1])) {
 
 
 
198
  $hasPort = true;
199
- $uri = $uri->withPort($hostHeaderParts[1]);
200
  }
201
  } elseif (isset($_SERVER['SERVER_NAME'])) {
202
  $uri = $uri->withHost($_SERVER['SERVER_NAME']);
@@ -210,7 +228,7 @@ class ServerRequest extends Request implements ServerRequestInterface
210
 
211
  $hasQuery = false;
212
  if (isset($_SERVER['REQUEST_URI'])) {
213
- $requestUriParts = explode('?', $_SERVER['REQUEST_URI']);
214
  $uri = $uri->withPath($requestUriParts[0]);
215
  if (isset($requestUriParts[1])) {
216
  $hasQuery = true;
166
  public static function fromGlobals()
167
  {
168
  $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
169
+ $headers = getallheaders();
170
  $uri = self::getUriFromGlobals();
171
  $body = new LazyOpenStream('php://input', 'r+');
172
  $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
180
  ->withUploadedFiles(self::normalizeFiles($_FILES));
181
  }
182
 
183
+ private static function extractHostAndPortFromAuthority($authority)
184
+ {
185
+ $uri = 'http://'.$authority;
186
+ $parts = parse_url($uri);
187
+ if (false === $parts) {
188
+ return [null, null];
189
+ }
190
+
191
+ $host = isset($parts['host']) ? $parts['host'] : null;
192
+ $port = isset($parts['port']) ? $parts['port'] : null;
193
+
194
+ return [$host, $port];
195
+ }
196
+
197
  /**
198
  * Get a Uri populated with values from $_SERVER.
199
  *
200
  * @return UriInterface
201
  */
202
+ public static function getUriFromGlobals()
203
+ {
204
  $uri = new Uri('');
205
 
206
  $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
207
 
208
  $hasPort = false;
209
  if (isset($_SERVER['HTTP_HOST'])) {
210
+ list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
211
+ if ($host !== null) {
212
+ $uri = $uri->withHost($host);
213
+ }
214
+
215
+ if ($port !== null) {
216
  $hasPort = true;
217
+ $uri = $uri->withPort($port);
218
  }
219
  } elseif (isset($_SERVER['SERVER_NAME'])) {
220
  $uri = $uri->withHost($_SERVER['SERVER_NAME']);
228
 
229
  $hasQuery = false;
230
  if (isset($_SERVER['REQUEST_URI'])) {
231
+ $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
232
  $uri = $uri->withPath($requestUriParts[0]);
233
  if (isset($requestUriParts[1])) {
234
  $hasQuery = true;
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Stream.php CHANGED
@@ -24,11 +24,11 @@ class Stream implements StreamInterface
24
  'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
25
  'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
26
  'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
27
- 'x+t' => true, 'c+t' => true, 'a+' => true
28
  ],
29
  'write' => [
30
  'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
31
- 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
32
  'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
33
  'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
34
  ]
@@ -70,15 +70,6 @@ class Stream implements StreamInterface
70
  $this->uri = $this->getMetadata('uri');
71
  }
72
 
73
- public function __get($name)
74
- {
75
- if ($name == 'stream') {
76
- throw new \RuntimeException('The stream is detached');
77
- }
78
-
79
- throw new \BadMethodCallException('No value for ' . $name);
80
- }
81
-
82
  /**
83
  * Closes the stream when the destructed
84
  */
@@ -99,6 +90,10 @@ class Stream implements StreamInterface
99
 
100
  public function getContents()
101
  {
 
 
 
 
102
  $contents = stream_get_contents($this->stream);
103
 
104
  if ($contents === false) {
@@ -173,11 +168,19 @@ class Stream implements StreamInterface
173
 
174
  public function eof()
175
  {
176
- return !$this->stream || feof($this->stream);
 
 
 
 
177
  }
178
 
179
  public function tell()
180
  {
 
 
 
 
181
  $result = ftell($this->stream);
182
 
183
  if ($result === false) {
@@ -194,9 +197,13 @@ class Stream implements StreamInterface
194
 
195
  public function seek($offset, $whence = SEEK_SET)
196
  {
 
 
 
197
  if (!$this->seekable) {
198
  throw new \RuntimeException('Stream is not seekable');
199
- } elseif (fseek($this->stream, $offset, $whence) === -1) {
 
200
  throw new \RuntimeException('Unable to seek to stream position '
201
  . $offset . ' with whence ' . var_export($whence, true));
202
  }
@@ -204,6 +211,9 @@ class Stream implements StreamInterface
204
 
205
  public function read($length)
206
  {
 
 
 
207
  if (!$this->readable) {
208
  throw new \RuntimeException('Cannot read from non-readable stream');
209
  }
@@ -225,6 +235,9 @@ class Stream implements StreamInterface
225
 
226
  public function write($string)
227
  {
 
 
 
228
  if (!$this->writable) {
229
  throw new \RuntimeException('Cannot write to a non-writable stream');
230
  }
24
  'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
25
  'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
26
  'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
27
+ 'x+t' => true, 'c+t' => true, 'a+' => true, 'rb+' => true,
28
  ],
29
  'write' => [
30
  'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
31
+ 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'rb+' => true,
32
  'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
33
  'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
34
  ]
70
  $this->uri = $this->getMetadata('uri');
71
  }
72
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Closes the stream when the destructed
75
  */
90
 
91
  public function getContents()
92
  {
93
+ if (!isset($this->stream)) {
94
+ throw new \RuntimeException('Stream is detached');
95
+ }
96
+
97
  $contents = stream_get_contents($this->stream);
98
 
99
  if ($contents === false) {
168
 
169
  public function eof()
170
  {
171
+ if (!isset($this->stream)) {
172
+ throw new \RuntimeException('Stream is detached');
173
+ }
174
+
175
+ return feof($this->stream);
176
  }
177
 
178
  public function tell()
179
  {
180
+ if (!isset($this->stream)) {
181
+ throw new \RuntimeException('Stream is detached');
182
+ }
183
+
184
  $result = ftell($this->stream);
185
 
186
  if ($result === false) {
197
 
198
  public function seek($offset, $whence = SEEK_SET)
199
  {
200
+ if (!isset($this->stream)) {
201
+ throw new \RuntimeException('Stream is detached');
202
+ }
203
  if (!$this->seekable) {
204
  throw new \RuntimeException('Stream is not seekable');
205
+ }
206
+ if (fseek($this->stream, $offset, $whence) === -1) {
207
  throw new \RuntimeException('Unable to seek to stream position '
208
  . $offset . ' with whence ' . var_export($whence, true));
209
  }
211
 
212
  public function read($length)
213
  {
214
+ if (!isset($this->stream)) {
215
+ throw new \RuntimeException('Stream is detached');
216
+ }
217
  if (!$this->readable) {
218
  throw new \RuntimeException('Cannot read from non-readable stream');
219
  }
235
 
236
  public function write($string)
237
  {
238
+ if (!isset($this->stream)) {
239
+ throw new \RuntimeException('Stream is detached');
240
+ }
241
  if (!$this->writable) {
242
  throw new \RuntimeException('Cannot write to a non-writable stream');
243
  }
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/StreamWrapper.php CHANGED
@@ -38,9 +38,21 @@ class StreamWrapper
38
  . 'writable, or both.');
39
  }
40
 
41
- return fopen('guzzle://stream', $mode, null, stream_context_create([
 
 
 
 
 
 
 
 
 
 
 
 
42
  'guzzle' => ['stream' => $stream]
43
- ]));
44
  }
45
 
46
  /**
@@ -94,12 +106,21 @@ class StreamWrapper
94
  return true;
95
  }
96
 
 
 
 
 
 
 
 
97
  public function stream_stat()
98
  {
99
  static $modeMap = [
100
  'r' => 33060,
 
101
  'r+' => 33206,
102
- 'w' => 33188
 
103
  ];
104
 
105
  return [
@@ -118,4 +139,23 @@ class StreamWrapper
118
  'blocks' => 0
119
  ];
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
38
  . 'writable, or both.');
39
  }
40
 
41
+ return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
42
+ }
43
+
44
+ /**
45
+ * Creates a stream context that can be used to open a stream as a php stream resource.
46
+ *
47
+ * @param StreamInterface $stream
48
+ *
49
+ * @return resource
50
+ */
51
+ public static function createStreamContext(StreamInterface $stream)
52
+ {
53
+ return stream_context_create([
54
  'guzzle' => ['stream' => $stream]
55
+ ]);
56
  }
57
 
58
  /**
106
  return true;
107
  }
108
 
109
+ public function stream_cast($cast_as)
110
+ {
111
+ $stream = clone($this->stream);
112
+
113
+ return $stream->detach();
114
+ }
115
+
116
  public function stream_stat()
117
  {
118
  static $modeMap = [
119
  'r' => 33060,
120
+ 'rb' => 33060,
121
  'r+' => 33206,
122
+ 'w' => 33188,
123
+ 'wb' => 33188
124
  ];
125
 
126
  return [
139
  'blocks' => 0
140
  ];
141
  }
142
+
143
+ public function url_stat($path, $flags)
144
+ {
145
+ return [
146
+ 'dev' => 0,
147
+ 'ino' => 0,
148
+ 'mode' => 0,
149
+ 'nlink' => 0,
150
+ 'uid' => 0,
151
+ 'gid' => 0,
152
+ 'rdev' => 0,
153
+ 'size' => 0,
154
+ 'atime' => 0,
155
+ 'mtime' => 0,
156
+ 'ctime' => 0,
157
+ 'blksize' => 0,
158
+ 'blocks' => 0
159
+ ];
160
+ }
161
  }
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/Uri.php CHANGED
@@ -301,15 +301,7 @@ class Uri implements UriInterface
301
  */
302
  public static function withoutQueryValue(UriInterface $uri, $key)
303
  {
304
- $current = $uri->getQuery();
305
- if ($current === '') {
306
- return $uri;
307
- }
308
-
309
- $decodedKey = rawurldecode($key);
310
- $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
311
- return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
312
- });
313
 
314
  return $uri->withQuery(implode('&', $result));
315
  }
@@ -331,26 +323,29 @@ class Uri implements UriInterface
331
  */
332
  public static function withQueryValue(UriInterface $uri, $key, $value)
333
  {
334
- $current = $uri->getQuery();
335
 
336
- if ($current === '') {
337
- $result = [];
338
- } else {
339
- $decodedKey = rawurldecode($key);
340
- $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
341
- return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
342
- });
343
- }
344
 
345
- // Query string separators ("=", "&") within the key or value need to be encoded
346
- // (while preventing double-encoding) before setting the query string. All other
347
- // chars that need percent-encoding will be encoded by withQuery().
348
- $key = strtr($key, self::$replaceQuery);
349
 
350
- if ($value !== null) {
351
- $result[] = $key . '=' . strtr($value, self::$replaceQuery);
352
- } else {
353
- $result[] = $key;
 
 
 
 
 
 
 
 
 
 
 
 
354
  }
355
 
356
  return $uri->withQuery(implode('&', $result));
@@ -620,6 +615,47 @@ class Uri implements UriInterface
620
  return $port;
621
  }
622
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  private function removeDefaultPort()
624
  {
625
  if ($this->port !== null && self::isDefaultPort($this)) {
301
  */
302
  public static function withoutQueryValue(UriInterface $uri, $key)
303
  {
304
+ $result = self::getFilteredQueryString($uri, [$key]);
 
 
 
 
 
 
 
 
305
 
306
  return $uri->withQuery(implode('&', $result));
307
  }
323
  */
324
  public static function withQueryValue(UriInterface $uri, $key, $value)
325
  {
326
+ $result = self::getFilteredQueryString($uri, [$key]);
327
 
328
+ $result[] = self::generateQueryString($key, $value);
 
 
 
 
 
 
 
329
 
330
+ return $uri->withQuery(implode('&', $result));
331
+ }
 
 
332
 
333
+ /**
334
+ * Creates a new URI with multiple specific query string values.
335
+ *
336
+ * It has the same behavior as withQueryValue() but for an associative array of key => value.
337
+ *
338
+ * @param UriInterface $uri URI to use as a base.
339
+ * @param array $keyValueArray Associative array of key and values
340
+ *
341
+ * @return UriInterface
342
+ */
343
+ public static function withQueryValues(UriInterface $uri, array $keyValueArray)
344
+ {
345
+ $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
346
+
347
+ foreach ($keyValueArray as $key => $value) {
348
+ $result[] = self::generateQueryString($key, $value);
349
  }
350
 
351
  return $uri->withQuery(implode('&', $result));
615
  return $port;
616
  }
617
 
618
+ /**
619
+ * @param UriInterface $uri
620
+ * @param array $keys
621
+ *
622
+ * @return array
623
+ */
624
+ private static function getFilteredQueryString(UriInterface $uri, array $keys)
625
+ {
626
+ $current = $uri->getQuery();
627
+
628
+ if ($current === '') {
629
+ return [];
630
+ }
631
+
632
+ $decodedKeys = array_map('rawurldecode', $keys);
633
+
634
+ return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
635
+ return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
636
+ });
637
+ }
638
+
639
+ /**
640
+ * @param string $key
641
+ * @param string|null $value
642
+ *
643
+ * @return string
644
+ */
645
+ private static function generateQueryString($key, $value)
646
+ {
647
+ // Query string separators ("=", "&") within the key or value need to be encoded
648
+ // (while preventing double-encoding) before setting the query string. All other
649
+ // chars that need percent-encoding will be encoded by withQuery().
650
+ $queryString = strtr($key, self::$replaceQuery);
651
+
652
+ if ($value !== null) {
653
+ $queryString .= '=' . strtr($value, self::$replaceQuery);
654
+ }
655
+
656
+ return $queryString;
657
+ }
658
+
659
  private function removeDefaultPort()
660
  {
661
  if ($this->port !== null && self::isDefaultPort($this)) {
includes/mollie-api-php/vendor/guzzlehttp/psr7/src/functions.php CHANGED
@@ -69,10 +69,10 @@ function uri_for($uri)
69
  * - metadata: Array of custom metadata.
70
  * - size: Size of the stream.
71
  *
72
- * @param resource|string|null|int|float|bool|StreamInterface|callable $resource Entity body data
73
- * @param array $options Additional options
74
  *
75
- * @return Stream
76
  * @throws \InvalidArgumentException if the $resource arg is not valid.
77
  */
78
  function stream_for($resource = '', array $options = [])
@@ -238,7 +238,7 @@ function modify_request(RequestInterface $request, array $changes)
238
  }
239
 
240
  if ($request instanceof ServerRequestInterface) {
241
- return new ServerRequest(
242
  isset($changes['method']) ? $changes['method'] : $request->getMethod(),
243
  $uri,
244
  $headers,
@@ -247,7 +247,11 @@ function modify_request(RequestInterface $request, array $changes)
247
  ? $changes['version']
248
  : $request->getProtocolVersion(),
249
  $request->getServerParams()
250
- );
 
 
 
 
251
  }
252
 
253
  return new Request(
@@ -431,7 +435,7 @@ function hash(
431
  * @param StreamInterface $stream Stream to read from
432
  * @param int $maxLength Maximum buffer length
433
  *
434
- * @return string|bool
435
  */
436
  function readline(StreamInterface $stream, $maxLength = null)
437
  {
@@ -495,7 +499,7 @@ function parse_response($message)
495
  // between status-code and reason-phrase is required. But browsers accept
496
  // responses without space and reason as well.
497
  if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
498
- throw new \InvalidArgumentException('Invalid response string');
499
  }
500
  $parts = explode(' ', $data['start-line'], 3);
501
 
@@ -516,8 +520,8 @@ function parse_response($message)
516
  * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
517
  * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
518
  *
519
- * @param string $str Query string to parse
520
- * @param bool|string $urlEncoding How the query string is encoded
521
  *
522
  * @return array
523
  */
@@ -533,9 +537,9 @@ function parse_query($str, $urlEncoding = true)
533
  $decoder = function ($value) {
534
  return rawurldecode(str_replace('+', ' ', $value));
535
  };
536
- } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
537
  $decoder = 'rawurldecode';
538
- } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
539
  $decoder = 'urldecode';
540
  } else {
541
  $decoder = function ($str) { return $str; };
@@ -633,6 +637,7 @@ function mimetype_from_filename($filename)
633
  function mimetype_from_extension($extension)
634
  {
635
  static $mimetypes = [
 
636
  '7z' => 'application/x-7z-compressed',
637
  'aac' => 'audio/x-aac',
638
  'ai' => 'application/postscript',
@@ -680,6 +685,7 @@ function mimetype_from_extension($extension)
680
  'mid' => 'audio/midi',
681
  'midi' => 'audio/midi',
682
  'mov' => 'video/quicktime',
 
683
  'mp3' => 'audio/mpeg',
684
  'mp4' => 'video/mp4',
685
  'mp4a' => 'audio/mp4',
@@ -758,29 +764,53 @@ function _parse_message($message)
758
  throw new \InvalidArgumentException('Invalid message');
759
  }
760
 
761
- // Iterate over each line in the message, accounting for line endings
762
- $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
763
- $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
764
- array_shift($lines);
765
 
766
- for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
767
- $line = $lines[$i];
768
- // If two line breaks were encountered, then this is the end of body
769
- if (empty($line)) {
770
- if ($i < $totalLines - 1) {
771
- $result['body'] = implode('', array_slice($lines, $i + 2));
772
- }
773
- break;
774
- }
775
- if (strpos($line, ':')) {
776
- $parts = explode(':', $line, 2);
777
- $key = trim($parts[0]);
778
- $value = isset($parts[1]) ? trim($parts[1]) : '';
779
- $result['headers'][$key][] = $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  }
 
 
781
  }
782
 
783
- return $result;
 
 
 
 
 
 
 
 
 
 
784
  }
785
 
786
  /**
@@ -809,6 +839,41 @@ function _parse_request_uri($path, array $headers)
809
  return $scheme . '://' . $host . '/' . ltrim($path, '/');
810
  }
811
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
812
  /** @internal */
813
  function _caseless_remove($keys, array $data)
814
  {
69
  * - metadata: Array of custom metadata.
70
  * - size: Size of the stream.
71
  *
72
+ * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
73
+ * @param array $options Additional options
74
  *
75
+ * @return StreamInterface
76
  * @throws \InvalidArgumentException if the $resource arg is not valid.
77
  */
78
  function stream_for($resource = '', array $options = [])
238
  }
239
 
240
  if ($request instanceof ServerRequestInterface) {
241
+ return (new ServerRequest(
242
  isset($changes['method']) ? $changes['method'] : $request->getMethod(),
243
  $uri,
244
  $headers,
247
  ? $changes['version']
248
  : $request->getProtocolVersion(),
249
  $request->getServerParams()
250
+ ))
251
+ ->withParsedBody($request->getParsedBody())
252
+ ->withQueryParams($request->getQueryParams())
253
+ ->withCookieParams($request->getCookieParams())
254
+ ->withUploadedFiles($request->getUploadedFiles());
255
  }
256
 
257
  return new Request(
435
  * @param StreamInterface $stream Stream to read from
436
  * @param int $maxLength Maximum buffer length
437
  *
438
+ * @return string
439
  */
440
  function readline(StreamInterface $stream, $maxLength = null)
441
  {
499
  // between status-code and reason-phrase is required. But browsers accept
500
  // responses without space and reason as well.
501
  if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
502
+ throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']);
503
  }
504
  $parts = explode(' ', $data['start-line'], 3);
505
 
520
  * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
521
  * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
522
  *
523
+ * @param string $str Query string to parse
524
+ * @param int|bool $urlEncoding How the query string is encoded
525
  *
526
  * @return array
527
  */
537
  $decoder = function ($value) {
538
  return rawurldecode(str_replace('+', ' ', $value));
539
  };
540
+ } elseif ($urlEncoding === PHP_QUERY_RFC3986) {
541
  $decoder = 'rawurldecode';
542
+ } elseif ($urlEncoding === PHP_QUERY_RFC1738) {
543
  $decoder = 'urldecode';
544
  } else {
545
  $decoder = function ($str) { return $str; };
637
  function mimetype_from_extension($extension)
638
  {
639
  static $mimetypes = [
640
+ '3gp' => 'video/3gpp',
641
  '7z' => 'application/x-7z-compressed',
642
  'aac' => 'audio/x-aac',
643
  'ai' => 'application/postscript',
685
  'mid' => 'audio/midi',
686
  'midi' => 'audio/midi',
687
  'mov' => 'video/quicktime',
688
+ 'mkv' => 'video/x-matroska',
689
  'mp3' => 'audio/mpeg',
690
  'mp4' => 'video/mp4',
691
  'mp4a' => 'audio/mp4',
764
  throw new \InvalidArgumentException('Invalid message');
765
  }
766
 
767
+ $message = ltrim($message, "\r\n");
 
 
 
768
 
769
+ $messageParts = preg_split("/\r?\n\r?\n/", $message, 2);
770
+
771
+ if ($messageParts === false || count($messageParts) !== 2) {
772
+ throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
773
+ }
774
+
775
+ list($rawHeaders, $body) = $messageParts;
776
+ $rawHeaders .= "\r\n"; // Put back the delimiter we split previously
777
+ $headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
778
+
779
+ if ($headerParts === false || count($headerParts) !== 2) {
780
+ throw new \InvalidArgumentException('Invalid message: Missing status line');
781
+ }
782
+
783
+ list($startLine, $rawHeaders) = $headerParts;
784
+
785
+ if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
786
+ // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
787
+ $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
788
+ }
789
+
790
+ /** @var array[] $headerLines */
791
+ $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
792
+
793
+ // If these aren't the same, then one line didn't match and there's an invalid header.
794
+ if ($count !== substr_count($rawHeaders, "\n")) {
795
+ // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
796
+ if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
797
+ throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
798
  }
799
+
800
+ throw new \InvalidArgumentException('Invalid header syntax');
801
  }
802
 
803
+ $headers = [];
804
+
805
+ foreach ($headerLines as $headerLine) {
806
+ $headers[$headerLine[1]][] = $headerLine[2];
807
+ }
808
+
809
+ return [
810
+ 'start-line' => $startLine,
811
+ 'headers' => $headers,
812
+ 'body' => $body,
813
+ ];
814
  }
815
 
816
  /**
839
  return $scheme . '://' . $host . '/' . ltrim($path, '/');
840
  }
841
 
842
+ /**
843
+ * Get a short summary of the message body
844
+ *
845
+ * Will return `null` if the response is not printable.
846
+ *
847
+ * @param MessageInterface $message The message to get the body summary
848
+ * @param int $truncateAt The maximum allowed size of the summary
849
+ *
850
+ * @return null|string
851
+ */
852
+ function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
853
+ {
854
+ $body = $message->getBody();
855
+
856
+ if (!$body->isSeekable()) {
857
+ return null;
858
+ }
859
+
860
+ $size = $body->getSize();
861
+ $summary = $body->read($truncateAt);
862
+ $body->rewind();
863
+
864
+ if ($size > $truncateAt) {
865
+ $summary .= ' (truncated...)';
866
+ }
867
+
868
+ // Matches any printable character, including unicode characters:
869
+ // letters, marks, numbers, punctuation, spacing, and separators.
870
+ if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
871
+ return null;
872
+ }
873
+
874
+ return $summary;
875
+ }
876
+
877
  /** @internal */
878
  function _caseless_remove($keys, array $data)
879
  {
includes/mollie-api-php/vendor/ralouphie/getallheaders/.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ .idea
2
+ .DS_store
3
+ /vendor/
4
+ composer.phar
5
+ composer.lock
includes/mollie-api-php/vendor/ralouphie/getallheaders/.travis.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php:
4
+ - 5.3
5
+ - 5.4
6
+ - 5.5
7
+ - 5.6
8
+ - 7.0
9
+
10
+ before_script:
11
+ - composer install
12
+
13
+ script:
14
+ - mkdir -p build/logs
15
+ - php vendor/bin/phpunit -c phpunit.xml
16
+
17
+ after_script:
18
+ - php vendor/bin/coveralls -v
includes/mollie-api-php/vendor/ralouphie/getallheaders/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Ralph Khattar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
includes/mollie-api-php/vendor/ralouphie/getallheaders/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ getallheaders
2
+ =============
3
+
4
+ PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3.
5
+
6
+ [![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders)
7
+ [![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master)
8
+ [![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders)
9
+ [![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders)
10
+ [![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders)
11
+
12
+
13
+ This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php).
14
+
15
+ ## Install
16
+
17
+ ```
18
+ composer require ralouphie/getallheaders
19
+ ```
includes/mollie-api-php/vendor/ralouphie/getallheaders/composer.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ralouphie/getallheaders",
3
+ "description": "A polyfill for getallheaders.",
4
+ "license": "MIT",
5
+ "authors": [
6
+ {
7
+ "name": "Ralph Khattar",
8
+ "email": "ralph.khattar@gmail.com"
9
+ }
10
+ ],
11
+ "require": {
12
+ "php": ">=5.3"
13
+ },
14
+ "require-dev": {
15
+ "phpunit/phpunit": "~3.7.0",
16
+ "satooshi/php-coveralls": ">=1.0"
17
+ },
18
+ "autoload": {
19
+ "files": ["src/getallheaders.php"]
20
+ }
21
+ }
includes/mollie-api-php/vendor/ralouphie/getallheaders/phpunit.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit
2
+ bootstrap="vendor/autoload.php"
3
+ convertErrorsToExceptions="true"
4
+ convertNoticesToExceptions="true"
5
+ convertWarningsToExceptions="true"
6
+ strict="true">
7
+
8
+ <testsuite>
9
+ <directory>./tests</directory>
10
+ </testsuite>
11
+
12
+ <filter>
13
+ <whitelist>
14
+ <directory suffix=".php">src</directory>
15
+ </whitelist>
16
+ </filter>
17
+
18
+ <logging>
19
+ <log type="coverage-clover" target="build/logs/clover.xml"/>
20
+ </logging>
21
+
22
+ </phpunit>
includes/mollie-api-php/vendor/ralouphie/getallheaders/src/getallheaders.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!function_exists('getallheaders')) {
4
+
5
+ /**
6
+ * Get all HTTP header key/values as an associative array for the current request.
7
+ *
8
+ * @return string[string] The HTTP header key/value pairs.
9
+ */
10
+ function getallheaders()
11
+ {
12
+ $headers = array();
13
+
14
+ $copy_server = array(
15
+ 'CONTENT_TYPE' => 'Content-Type',
16
+ 'CONTENT_LENGTH' => 'Content-Length',
17
+ 'CONTENT_MD5' => 'Content-Md5',
18
+ );
19
+
20
+ foreach ($_SERVER as $key => $value) {
21
+ if (substr($key, 0, 5) === 'HTTP_') {
22
+ $key = substr($key, 5);
23
+ if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) {
24
+ $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
25
+ $headers[$key] = $value;
26
+ }
27
+ } elseif (isset($copy_server[$key])) {
28
+ $headers[$copy_server[$key]] = $value;
29
+ }
30
+ }
31
+
32
+ if (!isset($headers['Authorization'])) {
33
+ if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
34
+ $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
35
+ } elseif (isset($_SERVER['PHP_AUTH_USER'])) {
36
+ $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
37
+ $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass);
38
+ } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) {
39
+ $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST'];
40
+ }
41
+ }
42
+
43
+ return $headers;
44
+ }
45
+
46
+ }
includes/mollie-api-php/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GetAllHeadersTest extends \PHPUnit_Framework_TestCase
4
+ {
5
+
6
+ /**
7
+ * @dataProvider testWorksData
8
+ */
9
+ public function testWorks($test_type, $expected, $server)
10
+ {
11
+ foreach ($server as $key => $val) {
12
+ $_SERVER[$key] = $val;
13
+ }
14
+ $result = getallheaders();
15
+ $this->assertEquals($expected, $result, "Error testing $test_type works.");
16
+ }
17
+
18
+ public function testWorksData()
19
+ {
20
+ return array(
21
+ array(
22
+ 'normal case',
23
+ array(
24
+ 'Key-One' => 'foo',
25
+ 'Key-Two' => 'bar',
26
+ 'Another-Key-For-Testing' => 'baz'
27
+ ),
28
+ array(
29
+ 'HTTP_KEY_ONE' => 'foo',
30
+ 'HTTP_KEY_TWO' => 'bar',
31
+ 'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz'
32
+ )
33
+ ),
34
+ array(
35
+ 'Content-Type',
36
+ array(
37
+ 'Content-Type' => 'two'
38
+ ),
39
+ array(
40
+ 'HTTP_CONTENT_TYPE' => 'one',
41
+ 'CONTENT_TYPE' => 'two'
42
+ )
43
+ ),
44
+ array(
45
+ 'Content-Length',
46
+ array(
47
+ 'Content-Length' => '222'
48
+ ),
49
+ array(
50
+ 'CONTENT_LENGTH' => '222',
51
+ 'HTTP_CONTENT_LENGTH' => '111'
52
+ )
53
+ ),
54
+ array(
55
+ 'Content-Length (HTTP_CONTENT_LENGTH only)',
56
+ array(
57
+ 'Content-Length' => '111'
58
+ ),
59
+ array(
60
+ 'HTTP_CONTENT_LENGTH' => '111'
61
+ )
62
+ ),
63
+ array(
64
+ 'Content-MD5',
65
+ array(
66
+ 'Content-Md5' => 'aef123'
67
+ ),
68
+ array(
69
+ 'CONTENT_MD5' => 'aef123',
70
+ 'HTTP_CONTENT_MD5' => 'fea321'
71
+ )
72
+ ),
73
+ array(
74
+ 'Content-MD5 (HTTP_CONTENT_MD5 only)',
75
+ array(
76
+ 'Content-Md5' => 'f123'
77
+ ),
78
+ array(
79
+ 'HTTP_CONTENT_MD5' => 'f123'
80
+ )
81
+ ),
82
+ array(
83
+ 'Authorization (normal)',
84
+ array(
85
+ 'Authorization' => 'testing'
86
+ ),
87
+ array(
88
+ 'HTTP_AUTHORIZATION' => 'testing',
89
+ )
90
+ ),
91
+ array(
92
+ 'Authorization (redirect)',
93
+ array(
94
+ 'Authorization' => 'testing redirect'
95
+ ),
96
+ array(
97
+ 'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect',
98
+ )
99
+ ),
100
+ array(
101
+ 'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)',
102
+ array(
103
+ 'Authorization' => 'Basic ' . base64_encode('foo:bar')
104
+ ),
105
+ array(
106
+ 'PHP_AUTH_USER' => 'foo',
107
+ 'PHP_AUTH_PW' => 'bar'
108
+ )
109
+ ),
110
+ array(
111
+ 'Authorization (PHP_AUTH_DIGEST)',
112
+ array(
113
+ 'Authorization' => 'example-digest'
114
+ ),
115
+ array(
116
+ 'PHP_AUTH_DIGEST' => 'example-digest'
117
+ )
118
+ )
119
+ );
120
+ }
121
+ }
includes/mollie/wc/gateway/abstract.php CHANGED
@@ -278,7 +278,9 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
278
  $currency = get_woocommerce_currency();
279
  }
280
 
281
- $billing_country = apply_filters( Mollie_WC_Plugin::PLUGIN_ID . '_is_available_billing_country_for_payment_gateways', WC()->customer->get_billing_country() );
 
 
282
 
283
  // Get current locale for this user
284
  $payment_locale = Mollie_WC_Plugin::getSettingsHelper()->getPaymentLocale();
278
  $currency = get_woocommerce_currency();
279
  }
280
 
281
+ global $woocommerce;
282
+ $billing_country = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $woocommerce->customer->get_country() : WC()->customer->get_billing_country();
283
+ $billing_country = apply_filters( Mollie_WC_Plugin::PLUGIN_ID . '_is_available_billing_country_for_payment_gateways', $billing_country );
284
 
285
  // Get current locale for this user
286
  $payment_locale = Mollie_WC_Plugin::getSettingsHelper()->getPaymentLocale();
includes/mollie/wc/gateway/abstractsubscription.php CHANGED
@@ -15,8 +15,13 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
15
 
16
  if ( class_exists( 'WC_Subscriptions_Order' ) ) {
17
  add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'scheduled_subscription_payment' ), 10, 2 );
 
 
18
  add_action( 'wcs_resubscribe_order_created', array( $this, 'delete_resubscribe_meta' ), 10 );
19
- add_action( 'wcs_renewal_order_created', array( $this, 'delete_renewal_meta' ), 10 );
 
 
 
20
  add_action( 'woocommerce_subscription_failing_payment_method_updated_mollie', array( $this, 'update_failing_payment_method' ), 10, 2 );
21
 
22
  add_filter( 'woocommerce_subscription_payment_meta', array( $this, 'add_subscription_payment_meta' ), 10, 2 );
@@ -222,9 +227,9 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
222
  $subscription_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->id : $subscription->get_id();
223
  $subscription_mollie_payment_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? get_post_meta( $subscription_id, '_mollie_payment_id', $single = true ) : $subscription->get_meta( '_mollie_payment_id' );
224
 
225
- if ( empty( $customer_id ) && ! empty( $subscription_mollie_payment_id ) ) {
226
- $customer_id = $this->restore_mollie_customer_id( $subscription_mollie_payment_id, $subscription );
227
- }
228
 
229
  // Get all data for the renewal payment
230
  $data = $this->getRecurringPaymentRequestData($renewal_order, $customer_id);
@@ -255,7 +260,7 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
255
 
256
  }
257
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
258
- throw new \Mollie\Api\Exceptions\ApiException( sprintf( __( 'The customer (%s) could not be used or found', 'mollie-payments-for-woocommerce-mandate-problem' ), $customer_id ) );
259
  }
260
 
261
  // Check that there is at least one valid mandate
@@ -327,6 +332,13 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
327
 
328
  foreach( $subscriptions as $subscription ) {
329
  $paymentMode = get_post_meta( $subscription->id, '_mollie_payment_mode', true );
 
 
 
 
 
 
 
330
  if ($paymentMode == self::PAYMENT_TEST_MODE){
331
  $result = true;
332
  break;
@@ -339,6 +351,13 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
339
 
340
  foreach( $subscriptions as $subscription ) {
341
  $paymentMode = $subscription->get_meta( '_mollie_payment_mode', true );
 
 
 
 
 
 
 
342
  if ($paymentMode == self::PAYMENT_TEST_MODE){
343
  $result = true;
344
  break;
@@ -453,14 +472,10 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
453
  public function delete_renewal_meta( $renewal_order )
454
  {
455
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
456
- delete_post_meta( $renewal_order->id, '_mollie_card_4_digits' );
457
  delete_post_meta( $renewal_order->id, '_mollie_payment_id' );
458
- delete_post_meta( $renewal_order->id, '_mollie_payment_mode' );
459
  delete_post_meta( $renewal_order->id, '_mollie_cancelled_payment_id' );
460
  } else {
461
- $renewal_order->delete_meta_data( '_mollie_card_4_digits' );
462
  $renewal_order->delete_meta_data( '_mollie_payment_id' );
463
- $renewal_order->delete_meta_data( '_mollie_payment_mode' );
464
  $renewal_order->delete_meta_data( '_mollie_cancelled_payment_id' );
465
  $renewal_order->save();
466
  }
@@ -487,10 +502,6 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
487
  $mollie_customer_id = $subscription->get_meta( '_mollie_customer_id', true );
488
  }
489
 
490
- if ( empty( $mollie_customer_id ) && ! empty( $mollie_payment_id ) ) {
491
- $mollie_customer_id = $this->restore_mollie_customer_id( $mollie_payment_id, $subscription );
492
- }
493
-
494
  $payment_meta[ $this->id ] = array (
495
  'post_meta' => array (
496
  '_mollie_payment_id' => array (
@@ -565,35 +576,45 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
565
  }
566
 
567
  /**
 
568
  * @param $mollie_payment_id
569
  * @param $subscription
570
  *
571
- * @return bool
572
- * @throws \Mollie\Api\Exceptions\ApiException
573
  */
574
- public function restore_mollie_customer_id( $mollie_payment_id, $subscription ) {
575
 
576
  try {
577
  // Get subscription ID
578
  $subscription_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->id : $subscription->get_id();
579
 
580
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: no valid customer ID found, trying to restore from Mollie API.' );
581
-
582
  // Get full payment object from Mollie API
583
  $payment_object_resource = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $mollie_payment_id );
584
 
585
- // Try to get the customer ID from the payment object
586
- $mollie_customer_id = $payment_object_resource->getMollieCustomerIdFromPaymentObject( $mollie_payment_id );
 
587
 
588
- if ( empty( $mollie_customer_id ) ) {
589
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: stopped processing, no customer ID found for this customer/payment combination.' );
 
 
 
 
 
 
 
 
 
 
 
590
 
591
- return '';
592
- } else {
593
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: customer ID found, verifying status of customer and mandate(s).' );
594
  }
595
 
596
- // Also check for valid mandates
 
 
 
597
  $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
598
  $test_mode = $settings_helper->isTestModeEnabled();
599
 
@@ -603,7 +624,7 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
603
  if ( ! $gateway || ! ( $gateway instanceof Mollie_WC_Gateway_Abstract ) ) {
604
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: stopped processing, not a Mollie payment gateway, could not restore customer ID.' );
605
 
606
- return '';
607
  }
608
 
609
  $mollie_method = $gateway->getMollieMethodId();
@@ -638,31 +659,45 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
638
  // Get a Payment object from Mollie to check for paid status
639
  $payment_object = $payment_object_resource->getPaymentObject( $mollie_payment_id );
640
 
 
 
 
641
  // Check SEPA Direct Debit payments and mandates
642
- if ( $mollie_method == 'directdebit' && ! $mandates->hasValidMandateForMethod( $mollie_method ) && $payment_object->isPaid() ) {
643
 
644
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: no valid mandate for payment method ' . $mollie_method . ' found, trying to create one.' );
645
 
646
- $options = $payment_object_resource->getMollieCustomerIbanDetailsFromPaymentObject( $mollie_payment_id );
 
 
 
 
 
 
 
 
 
 
 
647
  $options['method'] = $mollie_method;
648
 
649
  $customer = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->customers->get( $mollie_customer_id );
650
  Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->mandates->createFor( $customer, $options );
651
 
 
 
652
  } else {
653
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: failed! No valid mandate(s) for payment method ' . $mollie_method . ' found, and no paid payment to create one from.' );
654
  }
655
 
656
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: mandate created successfully, customer restored.' );
657
-
658
  return $mollie_customer_id;
659
 
660
  }
661
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
662
 
663
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: failed. ' . $e->getMessage() );
664
 
665
- return '';
666
  }
667
  }
668
 
15
 
16
  if ( class_exists( 'WC_Subscriptions_Order' ) ) {
17
  add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'scheduled_subscription_payment' ), 10, 2 );
18
+
19
+ // A resubscribe order to record a customer resubscribing to an expired or cancelled subscription.
20
  add_action( 'wcs_resubscribe_order_created', array( $this, 'delete_resubscribe_meta' ), 10 );
21
+
22
+ // After creating a renewal order to record a scheduled subscription payment with the same post meta, order items etc.
23
+ add_action( 'wcs_renewal_order_created', array( $this, 'delete_renewal_meta' ), 10 );
24
+
25
  add_action( 'woocommerce_subscription_failing_payment_method_updated_mollie', array( $this, 'update_failing_payment_method' ), 10, 2 );
26
 
27
  add_filter( 'woocommerce_subscription_payment_meta', array( $this, 'add_subscription_payment_meta' ), 10, 2 );
227
  $subscription_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->id : $subscription->get_id();
228
  $subscription_mollie_payment_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? get_post_meta( $subscription_id, '_mollie_payment_id', $single = true ) : $subscription->get_meta( '_mollie_payment_id' );
229
 
230
+ if ( ! empty( $subscription_mollie_payment_id ) && ! empty( $subscription ) ) {
231
+ $customer_id = $this->restore_mollie_customer_id_and_mandate( $customer_id, $subscription_mollie_payment_id, $subscription );
232
+ }
233
 
234
  // Get all data for the renewal payment
235
  $data = $this->getRecurringPaymentRequestData($renewal_order, $customer_id);
260
 
261
  }
262
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
263
+ throw new \Mollie\Api\Exceptions\ApiException( sprintf( __( 'The customer (%s) could not be used or found. ' . $e->getMessage(), 'mollie-payments-for-woocommerce-mandate-problem' ), $customer_id ) );
264
  }
265
 
266
  // Check that there is at least one valid mandate
332
 
333
  foreach( $subscriptions as $subscription ) {
334
  $paymentMode = get_post_meta( $subscription->id, '_mollie_payment_mode', true );
335
+
336
+ // If subscription does not contain the mode, try getting it from the parent order
337
+ if ( empty( $paymentMode ) ) {
338
+ $parent_order = $subscription->order->id;
339
+ $paymentMode = get_post_meta( $parent_order, '_mollie_payment_mode', true );
340
+ }
341
+
342
  if ($paymentMode == self::PAYMENT_TEST_MODE){
343
  $result = true;
344
  break;
351
 
352
  foreach( $subscriptions as $subscription ) {
353
  $paymentMode = $subscription->get_meta( '_mollie_payment_mode', true );
354
+
355
+ // If subscription does not contain the mode, try getting it from the parent order
356
+ if ( empty( $paymentMode ) ) {
357
+ $parent_order = new WC_Order($subscription->get_parent_id());
358
+ $paymentMode = $parent_order->get_meta( '_mollie_payment_mode', true );
359
+ }
360
+
361
  if ($paymentMode == self::PAYMENT_TEST_MODE){
362
  $result = true;
363
  break;
472
  public function delete_renewal_meta( $renewal_order )
473
  {
474
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
 
475
  delete_post_meta( $renewal_order->id, '_mollie_payment_id' );
 
476
  delete_post_meta( $renewal_order->id, '_mollie_cancelled_payment_id' );
477
  } else {
 
478
  $renewal_order->delete_meta_data( '_mollie_payment_id' );
 
479
  $renewal_order->delete_meta_data( '_mollie_cancelled_payment_id' );
480
  $renewal_order->save();
481
  }
502
  $mollie_customer_id = $subscription->get_meta( '_mollie_customer_id', true );
503
  }
504
 
 
 
 
 
505
  $payment_meta[ $this->id ] = array (
506
  'post_meta' => array (
507
  '_mollie_payment_id' => array (
576
  }
577
 
578
  /**
579
+ * @param $mollie_customer_id
580
  * @param $mollie_payment_id
581
  * @param $subscription
582
  *
583
+ * @return string
 
584
  */
585
+ public function restore_mollie_customer_id_and_mandate( $mollie_customer_id, $mollie_payment_id, $subscription ) {
586
 
587
  try {
588
  // Get subscription ID
589
  $subscription_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->id : $subscription->get_id();
590
 
 
 
591
  // Get full payment object from Mollie API
592
  $payment_object_resource = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $mollie_payment_id );
593
 
594
+ //
595
+ // If there is no known customer ID, try to get it from the API
596
+ //
597
 
598
+ if ( empty ( $mollie_customer_id ) ) {
599
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: no valid customer ID found, trying to restore from Mollie API payment (' . $mollie_payment_id . ').' );
600
+
601
+ // Try to get the customer ID from the payment object
602
+ $mollie_customer_id = $payment_object_resource->getMollieCustomerIdFromPaymentObject( $mollie_payment_id );
603
+
604
+ if ( empty( $mollie_customer_id ) ) {
605
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: stopped processing, no customer ID found for this customer/payment combination.' );
606
+
607
+ return $mollie_customer_id;
608
+ }
609
+
610
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: customer ID (' . $mollie_customer_id . ') found, verifying status of customer and mandate(s).' );
611
 
 
 
 
612
  }
613
 
614
+ //
615
+ // Check for valid mandates
616
+ //
617
+
618
  $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
619
  $test_mode = $settings_helper->isTestModeEnabled();
620
 
624
  if ( ! $gateway || ! ( $gateway instanceof Mollie_WC_Gateway_Abstract ) ) {
625
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: stopped processing, not a Mollie payment gateway, could not restore customer ID.' );
626
 
627
+ return $mollie_customer_id;
628
  }
629
 
630
  $mollie_method = $gateway->getMollieMethodId();
659
  // Get a Payment object from Mollie to check for paid status
660
  $payment_object = $payment_object_resource->getPaymentObject( $mollie_payment_id );
661
 
662
+ // Extra check that first payment was not sequenceType first
663
+ $sequence_type = $payment_object_resource->getSequenceTypeFromPaymentObject( $mollie_payment_id );
664
+
665
  // Check SEPA Direct Debit payments and mandates
666
+ if ( $mollie_method == 'directdebit' && ! $mandates->hasValidMandateForMethod( $mollie_method ) && $payment_object->isPaid() && $sequence_type == 'oneoff' ) {
667
 
668
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: no valid mandate for payment method ' . $mollie_method . ' found, trying to create one.' );
669
 
670
+ $options = $payment_object_resource->getMollieCustomerIbanDetailsFromPaymentObject( $mollie_payment_id );
671
+
672
+ // consumerName can be empty for Bancontact payments, in that case use the WooCommerce customer name
673
+ if ( empty( $options['consumerName'] ) ) {
674
+
675
+ $billing_first_name = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->billing_first_name : $subscription->get_billing_first_name();
676
+ $billing_last_name = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->billing_last_name : $subscription->get_billing_last_name();
677
+
678
+ $options['consumerName'] = $billing_first_name . ' ' . $billing_last_name;
679
+ }
680
+
681
+ // Set method
682
  $options['method'] = $mollie_method;
683
 
684
  $customer = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->customers->get( $mollie_customer_id );
685
  Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->mandates->createFor( $customer, $options );
686
 
687
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: mandate created successfully, customer restored.' );
688
+
689
  } else {
690
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: the subscription doesn\'t meet the conditions for a mandate restore.' );
691
  }
692
 
 
 
693
  return $mollie_customer_id;
694
 
695
  }
696
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
697
 
698
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: customer id and mandate restore failed. ' . $e->getMessage() );
699
 
700
+ return $mollie_customer_id;
701
  }
702
  }
703
 
includes/mollie/wc/payment/order.php CHANGED
@@ -157,7 +157,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
157
  }
158
 
159
  // Only add shippingAddress if all required fields are set
160
- if ( isset( $shippingAddress->streetAndNumber ) && isset( $shippingAddress->postalCode ) && isset( $shippingAddress->city ) && isset( $shippingAddress->country ) ) {
161
  $paymentRequestData['shippingAddress'] = $shippingAddress;
162
  }
163
 
@@ -214,6 +214,24 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
214
  return null;
215
  }
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  public function getMollieCustomerIbanDetailsFromPaymentObject( $payment = null ) {
218
 
219
  // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
157
  }
158
 
159
  // Only add shippingAddress if all required fields are set
160
+ if ( ! empty( $shippingAddress->streetAndNumber ) && ! empty( $shippingAddress->postalCode ) && ! empty( $shippingAddress->city ) && ! empty( $shippingAddress->country ) ) {
161
  $paymentRequestData['shippingAddress'] = $shippingAddress;
162
  }
163
 
214
  return null;
215
  }
216
 
217
+ public function getSequenceTypeFromPaymentObject( $payment = null ) {
218
+
219
+ // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
220
+ if ( $payment == null ) {
221
+ $payment = $this->data->id;
222
+ }
223
+
224
+ $payment = $this->getPaymentObject( $payment );
225
+
226
+ if ( isset( $payment->_embedded->payments{0}->sequenceType ) ) {
227
+
228
+ return $payment->_embedded->payments{0}->sequenceType;
229
+
230
+ }
231
+
232
+ return null;
233
+ }
234
+
235
  public function getMollieCustomerIbanDetailsFromPaymentObject( $payment = null ) {
236
 
237
  // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
includes/mollie/wc/payment/payment.php CHANGED
@@ -164,6 +164,23 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
164
  return null;
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  public function getMollieCustomerIbanDetailsFromPaymentObject( $payment = null ) {
168
 
169
  if ( $payment == null ) {
164
  return null;
165
  }
166
 
167
+ public function getSequenceTypeFromPaymentObject( $payment = null ) {
168
+
169
+ if ( $payment == null ) {
170
+ $payment = $this->data->id;
171
+ }
172
+
173
+ $payment = $this->getPaymentObject( $payment );
174
+
175
+ if ( isset( $payment->sequenceType ) ) {
176
+
177
+ return $payment->sequenceType;
178
+
179
+ }
180
+
181
+ return null;
182
+ }
183
+
184
  public function getMollieCustomerIbanDetailsFromPaymentObject( $payment = null ) {
185
 
186
  if ( $payment == null ) {
includes/mollie/wc/plugin.php CHANGED
@@ -7,7 +7,7 @@ class Mollie_WC_Plugin
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
- const PLUGIN_VERSION = '5.0.6';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
+ const PLUGIN_VERSION = '5.0.7';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
mollie-payments-for-woocommerce.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Mollie Payments for WooCommerce
4
  * Plugin URI: https://www.mollie.com
5
  * Description: Accept payments in WooCommerce with the official Mollie plugin
6
- * Version: 5.0.6
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
3
  * Plugin Name: Mollie Payments for WooCommerce
4
  * Plugin URI: https://www.mollie.com
5
  * Description: Accept payments in WooCommerce with the official Mollie plugin
6
+ * Version: 5.0.7
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: daanvm, davdebcom, l.vangunst, ndijkstra, robin-mollie
3
  Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, ideal, sofort, bancontact, bitcoin, direct debit, subscriptions
4
  Requires at least: 3.8
5
- Tested up to: 4.9
6
- Stable tag: 5.0.6
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -181,6 +181,16 @@ Automatic updates should work like a charm; as always though, ensure you backup
181
 
182
  == Changelog ==
183
 
 
 
 
 
 
 
 
 
 
 
184
  = 5.0.6 - 23-11-2018 =
185
 
186
  * Fix - Set subscription to On-Hold if renewal order gets a charge-back, add action hooks after refunds and chargebacks
2
  Contributors: daanvm, davdebcom, l.vangunst, ndijkstra, robin-mollie
3
  Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, ideal, sofort, bancontact, bitcoin, direct debit, subscriptions
4
  Requires at least: 3.8
5
+ Tested up to: 5.0
6
+ Stable tag: 5.0.7
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
181
 
182
  == Changelog ==
183
 
184
+ = 5.0.7 - 04-12-2018 =
185
+
186
+ * Fix - Bancontact payments don't return a name as part of IBAN details (in Mollie API), so in that case use the WooCommerce name
187
+ * Fix - WooCommerce 2.6 and older: use get_country instead of get_billing_country
188
+ * Fix - Remove calls to delete payment mode, renewal payments can't use a different mode anyway, mandates aren't shared between modes
189
+ * Fix - Subscription renewal payments: if subscription does not contain the payment mode, try getting it from the parent order
190
+ * Fix - For shipping details use !empty() instead of isset
191
+ * Fix - Further improve restore_mollie_customer_id so it catches more edge-cases (and rename to restore_mollie_customer_id_and_mandate)
192
+ * Fix - Remove delete meta calls for meta that wasn't used anywhere (_mollie_card_4_digits)
193
+
194
  = 5.0.6 - 23-11-2018 =
195
 
196
  * Fix - Set subscription to On-Hold if renewal order gets a charge-back, add action hooks after refunds and chargebacks