Mollie Payments for WooCommerce - Version 5.0.3

Version Description

  • 01-11-2018 =

IMPORTANT This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: PHP & Mollie API v2.

  • Fix - Improvements to refunds: better log messages, show errors to shop-manager
  • Fix - Remove option to set a description for payments, the new Orders API does not support this
  • Fix - Update WooCommerce status constants in our plugin (cancelled and refunded)
  • Fix - Make sure customer ID is stored by getting the payment object with all payments embedded
  • Fix - Get and use correct _mollie_payment_id in setActiveMolliePaymentForOrders and setActiveMolliePaymentForSubscriptions
  • Fix - Move adding of sequenceType into payment object
  • Fix - Update Webship Giftcard logo to webshopgiftcard.svg

  • Fix - Klarna/Orders API: Also send Address Line 2 to Mollie Orders API

  • Fix - Klarna/Orders API: In billing and shipping address check that fields aren't just a space

  • Fix - Klarna/Orders API: Decode HTML entities in product names before sending them to Mollie

  • Fix - Klarna/Orders API: Don't fall back to Payments API if payment method is Klarna

  • Fix - Klarna/Orders API: Only add shipping address if all required fields are present

  • Fix - Klarna/Orders API: Always store Mollie order ID as mollie_orderid

  • Fix - Klarna/Orders API: Add fallback to getActiveMolliePayment and try to get payment ID from Mollie order if possible

Download this release

Release Info

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

Code changes from version 5.0.2 to 5.0.3

assets/images/{webshop-giftcard.svg → webshopgiftcard.svg} RENAMED
File without changes
includes/mollie-api-php/composer.lock CHANGED
@@ -8,16 +8,16 @@
8
  "packages": [
9
  {
10
  "name": "composer/ca-bundle",
11
- "version": "1.1.2",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/composer/ca-bundle.git",
15
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
16
  },
17
  "dist": {
18
  "type": "zip",
19
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
20
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
21
  "shasum": ""
22
  },
23
  "require": {
@@ -60,7 +60,7 @@
60
  "ssl",
61
  "tls"
62
  ],
63
- "time": "2018-08-08T08:57:40+00:00"
64
  },
65
  {
66
  "name": "guzzlehttp/guzzle",
@@ -814,16 +814,16 @@
814
  },
815
  {
816
  "name": "phpunit/php-code-coverage",
817
- "version": "6.0.8",
818
  "source": {
819
  "type": "git",
820
  "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
821
- "reference": "848f78b3309780fef7ec8c4666b7ab4e6b09b22f"
822
  },
823
  "dist": {
824
  "type": "zip",
825
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/848f78b3309780fef7ec8c4666b7ab4e6b09b22f",
826
- "reference": "848f78b3309780fef7ec8c4666b7ab4e6b09b22f",
827
  "shasum": ""
828
  },
829
  "require": {
@@ -834,7 +834,7 @@
834
  "phpunit/php-text-template": "^1.2.1",
835
  "phpunit/php-token-stream": "^3.0",
836
  "sebastian/code-unit-reverse-lookup": "^1.0.1",
837
- "sebastian/environment": "^3.1",
838
  "sebastian/version": "^2.0.1",
839
  "theseer/tokenizer": "^1.1"
840
  },
@@ -847,7 +847,7 @@
847
  "type": "library",
848
  "extra": {
849
  "branch-alias": {
850
- "dev-master": "6.0-dev"
851
  }
852
  },
853
  "autoload": {
@@ -873,7 +873,7 @@
873
  "testing",
874
  "xunit"
875
  ],
876
- "time": "2018-10-04T03:41:23+00:00"
877
  },
878
  {
879
  "name": "phpunit/php-file-iterator",
@@ -1017,16 +1017,16 @@
1017
  },
1018
  {
1019
  "name": "phpunit/php-token-stream",
1020
- "version": "3.0.0",
1021
  "source": {
1022
  "type": "git",
1023
  "url": "https://github.com/sebastianbergmann/php-token-stream.git",
1024
- "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace"
1025
  },
1026
  "dist": {
1027
  "type": "zip",
1028
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace",
1029
- "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace",
1030
  "shasum": ""
1031
  },
1032
  "require": {
@@ -1062,20 +1062,20 @@
1062
  "keywords": [
1063
  "tokenizer"
1064
  ],
1065
- "time": "2018-02-01T13:16:43+00:00"
1066
  },
1067
  {
1068
  "name": "phpunit/phpunit",
1069
- "version": "7.4.0",
1070
  "source": {
1071
  "type": "git",
1072
  "url": "https://github.com/sebastianbergmann/phpunit.git",
1073
- "reference": "f3837fa1e07758057ae06e8ddec6d06ba183f126"
1074
  },
1075
  "dist": {
1076
  "type": "zip",
1077
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3837fa1e07758057ae06e8ddec6d06ba183f126",
1078
- "reference": "f3837fa1e07758057ae06e8ddec6d06ba183f126",
1079
  "shasum": ""
1080
  },
1081
  "require": {
@@ -1096,7 +1096,7 @@
1096
  "phpunit/php-timer": "^2.0",
1097
  "sebastian/comparator": "^3.0",
1098
  "sebastian/diff": "^3.0",
1099
- "sebastian/environment": "^3.1",
1100
  "sebastian/exporter": "^3.1",
1101
  "sebastian/global-state": "^2.0",
1102
  "sebastian/object-enumerator": "^3.0.3",
@@ -1146,7 +1146,7 @@
1146
  "testing",
1147
  "xunit"
1148
  ],
1149
- "time": "2018-10-05T04:05:24+00:00"
1150
  },
1151
  {
1152
  "name": "sebastian/code-unit-reverse-lookup",
8
  "packages": [
9
  {
10
  "name": "composer/ca-bundle",
11
+ "version": "1.1.3",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/composer/ca-bundle.git",
15
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
16
  },
17
  "dist": {
18
  "type": "zip",
19
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
20
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
21
  "shasum": ""
22
  },
23
  "require": {
60
  "ssl",
61
  "tls"
62
  ],
63
+ "time": "2018-10-18T06:09:13+00:00"
64
  },
65
  {
66
  "name": "guzzlehttp/guzzle",
814
  },
815
  {
816
  "name": "phpunit/php-code-coverage",
817
+ "version": "6.1.4",
818
  "source": {
819
  "type": "git",
820
  "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
821
+ "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d"
822
  },
823
  "dist": {
824
  "type": "zip",
825
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
826
+ "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
827
  "shasum": ""
828
  },
829
  "require": {
834
  "phpunit/php-text-template": "^1.2.1",
835
  "phpunit/php-token-stream": "^3.0",
836
  "sebastian/code-unit-reverse-lookup": "^1.0.1",
837
+ "sebastian/environment": "^3.1 || ^4.0",
838
  "sebastian/version": "^2.0.1",
839
  "theseer/tokenizer": "^1.1"
840
  },
847
  "type": "library",
848
  "extra": {
849
  "branch-alias": {
850
+ "dev-master": "6.1-dev"
851
  }
852
  },
853
  "autoload": {
873
  "testing",
874
  "xunit"
875
  ],
876
+ "time": "2018-10-31T16:06:48+00:00"
877
  },
878
  {
879
  "name": "phpunit/php-file-iterator",
1017
  },
1018
  {
1019
  "name": "phpunit/php-token-stream",
1020
+ "version": "3.0.1",
1021
  "source": {
1022
  "type": "git",
1023
  "url": "https://github.com/sebastianbergmann/php-token-stream.git",
1024
+ "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18"
1025
  },
1026
  "dist": {
1027
  "type": "zip",
1028
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18",
1029
+ "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18",
1030
  "shasum": ""
1031
  },
1032
  "require": {
1062
  "keywords": [
1063
  "tokenizer"
1064
  ],
1065
+ "time": "2018-10-30T05:52:18+00:00"
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
  "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
  "testing",
1147
  "xunit"
1148
  ],
1149
+ "time": "2018-10-23T05:57:41+00:00"
1150
  },
1151
  {
1152
  "name": "sebastian/code-unit-reverse-lookup",
includes/mollie-api-php/vendor/composer/ca-bundle/res/cacert.pem CHANGED
@@ -1,7 +1,7 @@
1
  ##
2
  ## Bundle of CA Root Certificates
3
  ##
4
- ## Certificate data from Mozilla as of: Wed Jun 20 03:12:06 2018 GMT
5
  ##
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -14,7 +14,7 @@
14
  ## Just configure this file as the SSLCACertificateFile.
15
  ##
16
  ## Conversion done with mk-ca-bundle.pl version 1.27.
17
- ## SHA256: c80f571d9f4ebca4a91e0ad3a546f263153d71afffc845c6f8f52ce9d1a2e8ec
18
  ##
19
 
20
 
@@ -2792,126 +2792,6 @@ GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
2792
  dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
2793
  -----END CERTIFICATE-----
2794
 
2795
- Certplus Root CA G1
2796
- ===================
2797
- -----BEGIN CERTIFICATE-----
2798
- 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
- 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
- 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
- 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
- ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
2803
- 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
- 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
- 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
- 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
- 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
- 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
- 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
2810
- jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
2811
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- +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
2822
- qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
2823
- -----END CERTIFICATE-----
2824
-
2825
- Certplus Root CA G2
2826
- ===================
2827
- -----BEGIN CERTIFICATE-----
2828
- MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
2829
- AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
2830
- NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
2831
- cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
2832
- BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
2833
- Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
2834
- AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
2835
- IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
2836
- HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
2837
- vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
2838
- -----END CERTIFICATE-----
2839
-
2840
- OpenTrust Root CA G1
2841
- ====================
2842
- -----BEGIN CERTIFICATE-----
2843
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
2858
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
2867
- OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
2868
- -----END CERTIFICATE-----
2869
-
2870
- OpenTrust Root CA G2
2871
- ====================
2872
- -----BEGIN CERTIFICATE-----
2873
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
2895
- 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
- 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
2897
- u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
2898
- -----END CERTIFICATE-----
2899
-
2900
- OpenTrust Root CA G3
2901
- ====================
2902
- -----BEGIN CERTIFICATE-----
2903
- MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
2904
- AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
2905
- DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
2906
- ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
2907
- IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
2908
- ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
2909
- /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
2910
- BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
2911
- BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
2912
- 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
2913
- -----END CERTIFICATE-----
2914
-
2915
  ISRG Root X1
2916
  ============
2917
  -----BEGIN CERTIFICATE-----
@@ -3312,3 +3192,49 @@ BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
3312
  N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
3313
  m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
3314
  -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ##
2
  ## Bundle of CA Root Certificates
3
  ##
4
+ ## Certificate data from Mozilla as of: Wed Oct 17 03:12:10 2018 GMT
5
  ##
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
14
  ## Just configure this file as the SSLCACertificateFile.
15
  ##
16
  ## Conversion done with mk-ca-bundle.pl version 1.27.
17
+ ## SHA256: 3f875d87fee4ce3d966c69f1d6c111aa95c0143ade59e4fa24882c582bb5f0ca
18
  ##
19
 
20
 
2792
  dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
2793
  -----END CERTIFICATE-----
2794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2795
  ISRG Root X1
2796
  ============
2797
  -----BEGIN CERTIFICATE-----
3192
  N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
3193
  m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
3194
  -----END CERTIFICATE-----
3195
+
3196
+ GlobalSign Root CA - R6
3197
+ =======================
3198
+ -----BEGIN CERTIFICATE-----
3199
+ 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
3224
+ -----END CERTIFICATE-----
3225
+
3226
+ OISTE WISeKey Global Root GC CA
3227
+ ===============================
3228
+ -----BEGIN CERTIFICATE-----
3229
+ MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
3230
+ SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
3231
+ MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
3232
+ Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
3233
+ ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
3234
+ bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
3235
+ VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
3236
+ NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
3237
+ BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
3238
+ AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
3239
+ AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
3240
+ -----END CERTIFICATE-----
includes/mollie-api-php/vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "composer/ca-bundle",
4
- "version": "1.1.2",
5
- "version_normalized": "1.1.2.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/ca-bundle.git",
9
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
14
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -24,7 +24,7 @@
24
  "psr/log": "^1.0",
25
  "symfony/process": "^2.5 || ^3.0 || ^4.0"
26
  },
27
- "time": "2018-08-08T08:57:40+00:00",
28
  "type": "library",
29
  "extra": {
30
  "branch-alias": {
1
  [
2
  {
3
  "name": "composer/ca-bundle",
4
+ "version": "1.1.3",
5
+ "version_normalized": "1.1.3.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/ca-bundle.git",
9
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
14
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
15
  "shasum": ""
16
  },
17
  "require": {
24
  "psr/log": "^1.0",
25
  "symfony/process": "^2.5 || ^3.0 || ^4.0"
26
  },
27
+ "time": "2018-10-18T06:09:13+00:00",
28
  "type": "library",
29
  "extra": {
30
  "branch-alias": {
includes/mollie/wc/gateway/abstract.php CHANGED
@@ -4,13 +4,16 @@ use Mollie\Api\Types\PaymentMethod;
4
 
5
  abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
6
  {
7
- const STATUS_PENDING = 'pending';
8
- const STATUS_PROCESSING = 'processing';
9
- const STATUS_ON_HOLD = 'on-hold';
10
- const STATUS_COMPLETED = 'completed';
11
- const STATUS_CANCELLED = 'canceled';
12
- // Mollie uses canceled (US English spelling), WooCommerce and this plugin use cancelled.
13
- const STATUS_FAILED = 'failed';
 
 
 
14
 
15
  /**
16
  * @var string
@@ -481,6 +484,14 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
481
  }
482
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
483
 
 
 
 
 
 
 
 
 
484
  Mollie_WC_Plugin::debug( 'Creating payment object: type Order, first try failed: ' . $e->getMessage() );
485
 
486
  // Unset missing customer ID
@@ -489,7 +500,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
489
  try {
490
 
491
  if ( $e->getField() !== 'payment.customerId' ) {
492
- Mollie_WC_Plugin::debug( 'Creating payment object: type Order, did not fail because of customerId, so trying Payment now.' );
493
  throw $e;
494
  }
495
 
@@ -508,14 +519,6 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
508
 
509
  $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
510
 
511
- // Don't try to create a Mollie Payment for Klarna payment methods
512
- $order_payment_method = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $order->payment_method : $order->get_payment_method();
513
-
514
- if ( $order_payment_method == 'mollie_wc_gateway_klarnapaylater' || $order_payment_method == 'mollie_wc_gateway_sliceit' ) {
515
- Mollie_WC_Plugin::debug( 'Creating payment object: removing method \'Klarna\' so cusromers can select another payment method at Mollie. ' );
516
- unset( $data['method'] );
517
- }
518
-
519
  try {
520
 
521
  // Only enable this for hardcore debugging!
@@ -1192,20 +1195,27 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1192
  public function process_refund( $order_id, $amount = null, $reason = '' ) {
1193
  $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
1194
 
 
1195
  if ( ! $order ) {
1196
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not find order ' . $order_id );
1197
 
1198
  return false;
1199
  }
1200
 
1201
- if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
1202
- $payment = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment( $order->id );
1203
- } else {
1204
- $payment = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment( $order->get_id() );
 
 
 
 
1205
  }
1206
 
1207
- // Mollie payment not found or invalid gateway
1208
- if ( ! $payment || $payment->method != $this->getMollieMethodId() ) {
 
 
1209
  return false;
1210
  }
1211
 
4
 
5
  abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
6
  {
7
+ /**
8
+ * WooCommerce default statuses
9
+ */
10
+ const STATUS_PENDING = 'pending';
11
+ const STATUS_PROCESSING = 'processing';
12
+ const STATUS_ON_HOLD = 'on-hold';
13
+ const STATUS_COMPLETED = 'completed';
14
+ const STATUS_CANCELLED = 'cancelled'; // Mollie uses canceled (US English spelling), WooCommerce and this plugin use cancelled.
15
+ const STATUS_FAILED = 'failed';
16
+ const STATUS_REFUNDED = 'refunded';
17
 
18
  /**
19
  * @var string
484
  }
485
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
486
 
487
+ // Don't try to create a Mollie Payment for Klarna payment methods
488
+ $order_payment_method = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $order->payment_method : $order->get_payment_method();
489
+
490
+ if ( $order_payment_method == 'mollie_wc_gateway_klarnapaylater' || $order_payment_method == 'mollie_wc_gateway_sliceit' ) {
491
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, failed for Klarna payment, stopping process.' );
492
+ throw $e;
493
+ }
494
+
495
  Mollie_WC_Plugin::debug( 'Creating payment object: type Order, first try failed: ' . $e->getMessage() );
496
 
497
  // Unset missing customer ID
500
  try {
501
 
502
  if ( $e->getField() !== 'payment.customerId' ) {
503
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, did not fail because of incorrect customerId, so trying Payment now.' );
504
  throw $e;
505
  }
506
 
519
 
520
  $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
521
 
 
 
 
 
 
 
 
 
522
  try {
523
 
524
  // Only enable this for hardcore debugging!
1195
  public function process_refund( $order_id, $amount = null, $reason = '' ) {
1196
  $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
1197
 
1198
+ // Order not found
1199
  if ( ! $order ) {
1200
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not find order ' . $order_id );
1201
 
1202
  return false;
1203
  }
1204
 
1205
+ // Get the Mollie payment
1206
+ $payment = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment( $order_id );
1207
+
1208
+ // Mollie payment not found
1209
+ if ( ! $payment ) {
1210
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Mollie payment object not found for order ' . $order_id );
1211
+
1212
+ return false;
1213
  }
1214
 
1215
+ // Payment method for order isn't the same as payment object method
1216
+ if ( $payment->method != $this->getMollieMethodId() ) {
1217
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Invalid refund gateway for order ' . $order_id );
1218
+
1219
  return false;
1220
  }
1221
 
includes/mollie/wc/gateway/abstractsubscription.php CHANGED
@@ -55,20 +55,6 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
55
  return parent::process_payment($order_id);
56
  }
57
 
58
- /**
59
- * @param $order
60
- * @param $customer_id
61
- * @return array
62
- */
63
- protected function getPaymentRequestData($order, $customer_id)
64
- {
65
- $paymentRequestData = parent::getPaymentRequestData($order, $customer_id);
66
- if ($this->isSubscriptionPayment){
67
- $paymentRequestData['sequenceType'] = 'first';
68
- }
69
- return $paymentRequestData;
70
- }
71
-
72
  /**
73
  * @param $order
74
  * @param $customer_id
55
  return parent::process_payment($order_id);
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * @param $order
60
  * @param $customer_id
includes/mollie/wc/helper/data.php CHANGED
@@ -313,14 +313,14 @@ class Mollie_WC_Helper_Data
313
 
314
  try {
315
 
316
- $filters_key = ( ! empty ( $filters['sequenceType'] ) ) ? '_' . $filters['sequenceType'] : '';
317
  $transient_id = Mollie_WC_Plugin::getDataHelper()->getTransientId( 'api_methods_' . ( $test_mode ? 'test' : 'live' ) . $filters_key );
318
 
319
  if ( $use_cache ) {
320
  $cached_methods = unserialize( get_transient( $transient_id ) );
321
 
322
  if ( $cached_methods && $cached_methods instanceof \Mollie\Api\Resources\MethodCollection ) {
323
- return $cached_methods;
324
  }
325
  }
326
 
@@ -330,7 +330,7 @@ class Mollie_WC_Helper_Data
330
  delete_transient( $transient_id );
331
 
332
  // TODO David: Support orders and payment resource?
333
- $filters['resource'] = 'orders';
334
 
335
  $methods = $this->api_helper->getApiClient( $test_mode )->methods->all( $filters );
336
 
313
 
314
  try {
315
 
316
+ $filters_key = ( ! empty ( $filters['sequenceType'] ) ) ? '_' . $filters['sequenceType'] : '';
317
  $transient_id = Mollie_WC_Plugin::getDataHelper()->getTransientId( 'api_methods_' . ( $test_mode ? 'test' : 'live' ) . $filters_key );
318
 
319
  if ( $use_cache ) {
320
  $cached_methods = unserialize( get_transient( $transient_id ) );
321
 
322
  if ( $cached_methods && $cached_methods instanceof \Mollie\Api\Resources\MethodCollection ) {
323
+ $methods = $cached_methods;
324
  }
325
  }
326
 
330
  delete_transient( $transient_id );
331
 
332
  // TODO David: Support orders and payment resource?
333
+ $filters['resource'] = 'orders';
334
 
335
  $methods = $this->api_helper->getApiClient( $test_mode )->methods->all( $filters );
336
 
includes/mollie/wc/helper/orderlines.php CHANGED
@@ -276,7 +276,7 @@ class Mollie_WC_Helper_OrderLines {
276
  $cart_item_data = $cart_item['data'];
277
  $item_name = $cart_item_data->get_name();
278
 
279
- return strip_tags( $item_name );
280
  }
281
 
282
  /**
276
  $cart_item_data = $cart_item['data'];
277
  $item_name = $cart_item_data->get_name();
278
 
279
+ return html_entity_decode(strip_tags($item_name) );
280
  }
281
 
282
  /**
includes/mollie/wc/helper/settings.php CHANGED
@@ -399,15 +399,6 @@ class Mollie_WC_Helper_Settings
399
  'placeholder' => $test_placeholder,
400
  'pattern' => '^test_\w{30,}$',
401
  ),
402
- ),
403
- array(
404
- 'id' => $this->getSettingId('payment_description'),
405
- 'title' => __('Description', 'mollie-payments-for-woocommerce'),
406
- 'type' => 'text',
407
- /* translators: Placeholder 1: Default payment description, placeholder 2: list of available tags */
408
- 'desc' => sprintf(__('Payment description send to Mollie. Default <code>%s</code><br/>You can use the following tags: %s', 'mollie-payments-for-woocommerce'), $default_payment_description, $payment_description_tags),
409
- 'default' => $default_payment_description,
410
- 'css' => 'width: 350px',
411
  ),
412
  array(
413
  'id' => $this->getSettingId('order_status_cancelled_payments'),
399
  'placeholder' => $test_placeholder,
400
  'pattern' => '^test_\w{30,}$',
401
  ),
 
 
 
 
 
 
 
 
 
402
  ),
403
  array(
404
  'id' => $this->getSettingId('order_status_cancelled_payments'),
includes/mollie/wc/payment/object.php CHANGED
@@ -43,6 +43,7 @@ class Mollie_WC_Payment_Object {
43
  * @return Mollie\Api\Resources\Payment|null
44
  */
45
  public function getPaymentObjectPayment( $payment_id, $test_mode = false, $use_cache = true ) {
 
46
  try {
47
 
48
  // Is test mode enabled?
@@ -60,11 +61,39 @@ class Mollie_WC_Payment_Object {
60
  return null;
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  /**
64
  * @param $order
65
  * @param $customer_id
66
  *
67
- * @return array
68
  */
69
  protected function getPaymentRequestData( $order, $customer_id ) {
70
 
@@ -101,7 +130,8 @@ class Mollie_WC_Payment_Object {
101
 
102
 
103
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
104
- update_post_meta( $order_id, '_mollie_payment_id', $this->data->id, $single = true );
 
105
  update_post_meta( $order_id, '_mollie_payment_mode', $this->data->mode, $single = true );
106
 
107
  delete_post_meta( $order_id, '_mollie_cancelled_payment_id' );
@@ -114,12 +144,13 @@ class Mollie_WC_Payment_Object {
114
 
115
  static::$order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
116
 
 
117
  static::$order->update_meta_data( '_mollie_payment_id', static::$paymentId );
118
  static::$order->update_meta_data( '_mollie_payment_mode', $this->data->mode );
119
 
120
  static::$order->delete_meta_data( '_mollie_cancelled_payment_id' );
121
 
122
- if ( isset( $this->data->customerId ) && $this->data->customerId ) {
123
  static::$order->update_meta_data( '_mollie_customer_id', static::$customerId );
124
  }
125
 
@@ -141,7 +172,7 @@ class Mollie_WC_Payment_Object {
141
 
142
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
143
 
144
- add_post_meta( $order_id, '_mollie_payment_id', $this->data->id, $single = true );
145
  add_post_meta( $order_id, '_mollie_payment_mode', $this->data->mode, $single = true );
146
 
147
  delete_post_meta( $order_id, '_mollie_cancelled_payment_id' );
@@ -162,7 +193,7 @@ class Mollie_WC_Payment_Object {
162
  foreach ( $subscriptions as $subscription ) {
163
  $this->unsetActiveMolliePayment( $subscription->id );
164
  delete_post_meta( $subscription->id, '_mollie_customer_id' );
165
- add_post_meta( $subscription->id, '_mollie_payment_id', $this->data->id, $single = true );
166
  add_post_meta( $subscription->id, '_mollie_payment_mode', $this->data->mode, $single = true );
167
  delete_post_meta( $subscription->id, '_mollie_cancelled_payment_id' );
168
  if ( static::$customerId ) {
@@ -174,7 +205,7 @@ class Mollie_WC_Payment_Object {
174
 
175
  $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
176
 
177
- $order->update_meta_data( '_mollie_payment_id', $this->data->id );
178
  $order->update_meta_data( '_mollie_payment_mode', $this->data->mode );
179
 
180
  $order->delete_meta_data( '_mollie_cancelled_payment_id' );
@@ -195,7 +226,7 @@ class Mollie_WC_Payment_Object {
195
  foreach ( $subscriptions as $subscription ) {
196
  $this->unsetActiveMolliePayment( $subscription->get_id() );
197
  $subscription->delete_meta_data( '_mollie_customer_id' );
198
- $subscription->update_meta_data( '_mollie_payment_id', $this->data->id );
199
  $subscription->update_meta_data( '_mollie_payment_mode', $this->data->mode );
200
  $subscription->delete_meta_data( '_mollie_cancelled_payment_id' );
201
  if ( static::$customerId ) {
@@ -309,6 +340,24 @@ class Mollie_WC_Payment_Object {
309
  return $mollie_payment_id;
310
  }
311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  /**
313
  * Get active Mollie payment mode for order
314
  *
@@ -334,6 +383,8 @@ class Mollie_WC_Payment_Object {
334
  * @return Mollie\Api\Resources\Payment|null
335
  */
336
  public function getActiveMolliePayment( $order_id, $use_cache = true ) {
 
 
337
  if ( $this->hasActiveMolliePayment( $order_id ) ) {
338
  return $this->getPaymentObjectPayment(
339
  $this->getActiveMolliePaymentId( $order_id ),
@@ -342,6 +393,18 @@ class Mollie_WC_Payment_Object {
342
  );
343
  }
344
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  return null;
346
  }
347
 
@@ -358,6 +421,19 @@ class Mollie_WC_Payment_Object {
358
  return ! empty( $mollie_payment_id );
359
  }
360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  /**
362
  * @param int $order_id
363
  * @param string $payment_id
@@ -481,6 +557,18 @@ class Mollie_WC_Payment_Object {
481
 
482
  }
483
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  /**
485
  * @return bool
486
  */
43
  * @return Mollie\Api\Resources\Payment|null
44
  */
45
  public function getPaymentObjectPayment( $payment_id, $test_mode = false, $use_cache = true ) {
46
+ // TODO David: Duplicate, send to child class.
47
  try {
48
 
49
  // Is test mode enabled?
61
  return null;
62
  }
63
 
64
+ /**
65
+ * Get Mollie payment from cache or load from Mollie
66
+ * Skip cache by setting $use_cache to false
67
+ *
68
+ * @param string $payment_id
69
+ * @param bool $test_mode (default: false)
70
+ * @param bool $use_cache (default: true)
71
+ *
72
+ * @return Mollie\Api\Resources\Payment|Mollie\Api\Resources\Order|null
73
+ */
74
+ public function getPaymentObjectOrder( $payment_id, $test_mode = false, $use_cache = true ) {
75
+ // TODO David: Duplicate, send to child class.
76
+ try {
77
+
78
+ // Is test mode enabled?
79
+ $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
80
+ $test_mode = $settings_helper->isTestModeEnabled();
81
+
82
+ $payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->get( $payment_id, [ "embed" => "payments" ] );
83
+
84
+ return $payment;
85
+ }
86
+ catch ( \Mollie\Api\Exceptions\ApiException $e ) {
87
+ Mollie_WC_Plugin::debug( __FUNCTION__ . ": Could not load order $payment_id (" . ( $test_mode ? 'test' : 'live' ) . "): " . $e->getMessage() . ' (' . get_class( $e ) . ')' );
88
+ }
89
+
90
+ return null;
91
+ }
92
+
93
  /**
94
  * @param $order
95
  * @param $customer_id
96
  *
 
97
  */
98
  protected function getPaymentRequestData( $order, $customer_id ) {
99
 
130
 
131
 
132
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
133
+ update_post_meta( $order_id, '_mollie_order_id', $this->data->id, $single = true );
134
+ update_post_meta( $order_id, '_mollie_payment_id', static::$paymentId, $single = true );
135
  update_post_meta( $order_id, '_mollie_payment_mode', $this->data->mode, $single = true );
136
 
137
  delete_post_meta( $order_id, '_mollie_cancelled_payment_id' );
144
 
145
  static::$order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
146
 
147
+ static::$order->update_meta_data( '_mollie_order_id', $this->data->id );
148
  static::$order->update_meta_data( '_mollie_payment_id', static::$paymentId );
149
  static::$order->update_meta_data( '_mollie_payment_mode', $this->data->mode );
150
 
151
  static::$order->delete_meta_data( '_mollie_cancelled_payment_id' );
152
 
153
+ if ( static::$customerId ) {
154
  static::$order->update_meta_data( '_mollie_customer_id', static::$customerId );
155
  }
156
 
172
 
173
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
174
 
175
+ add_post_meta( $order_id, '_mollie_payment_id', static::$paymentId, $single = true );
176
  add_post_meta( $order_id, '_mollie_payment_mode', $this->data->mode, $single = true );
177
 
178
  delete_post_meta( $order_id, '_mollie_cancelled_payment_id' );
193
  foreach ( $subscriptions as $subscription ) {
194
  $this->unsetActiveMolliePayment( $subscription->id );
195
  delete_post_meta( $subscription->id, '_mollie_customer_id' );
196
+ add_post_meta( $subscription->id, '_mollie_payment_id', static::$paymentId, $single = true );
197
  add_post_meta( $subscription->id, '_mollie_payment_mode', $this->data->mode, $single = true );
198
  delete_post_meta( $subscription->id, '_mollie_cancelled_payment_id' );
199
  if ( static::$customerId ) {
205
 
206
  $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
207
 
208
+ $order->update_meta_data( '_mollie_payment_id', static::$paymentId );
209
  $order->update_meta_data( '_mollie_payment_mode', $this->data->mode );
210
 
211
  $order->delete_meta_data( '_mollie_cancelled_payment_id' );
226
  foreach ( $subscriptions as $subscription ) {
227
  $this->unsetActiveMolliePayment( $subscription->get_id() );
228
  $subscription->delete_meta_data( '_mollie_customer_id' );
229
+ $subscription->update_meta_data( '_mollie_payment_id', static::$paymentId );
230
  $subscription->update_meta_data( '_mollie_payment_mode', $this->data->mode );
231
  $subscription->delete_meta_data( '_mollie_cancelled_payment_id' );
232
  if ( static::$customerId ) {
340
  return $mollie_payment_id;
341
  }
342
 
343
+ /**
344
+ * Get active Mollie payment id for order
345
+ *
346
+ * @param int $order_id
347
+ *
348
+ * @return string
349
+ */
350
+ public function getActiveMollieOrderId( $order_id ) {
351
+ if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
352
+ $mollie_payment_id = get_post_meta( $order_id, '_mollie_order_id', $single = true );
353
+ } else {
354
+ $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
355
+ $mollie_payment_id = $order->get_meta( '_mollie_order_id', true );
356
+ }
357
+
358
+ return $mollie_payment_id;
359
+ }
360
+
361
  /**
362
  * Get active Mollie payment mode for order
363
  *
383
  * @return Mollie\Api\Resources\Payment|null
384
  */
385
  public function getActiveMolliePayment( $order_id, $use_cache = true ) {
386
+
387
+ // Check if there is a payment ID stored with order and get it
388
  if ( $this->hasActiveMolliePayment( $order_id ) ) {
389
  return $this->getPaymentObjectPayment(
390
  $this->getActiveMolliePaymentId( $order_id ),
393
  );
394
  }
395
 
396
+ // If there is no payment ID, try to get order ID and if it's stored, try getting payment ID from API
397
+ if ( $this->hasActiveMollieOrder( $order_id ) ) {
398
+ $mollie_order = $this->getPaymentObjectOrder($this->getActiveMollieOrderId( $order_id ));
399
+ $mollie_order = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $mollie_order );
400
+
401
+ return $this->getPaymentObjectPayment(
402
+ $mollie_order->getMolliePaymentIdFromPaymentObject(),
403
+ $this->getActiveMolliePaymentMode( $order_id ) == 'test',
404
+ $use_cache
405
+ );
406
+ }
407
+
408
  return null;
409
  }
410
 
421
  return ! empty( $mollie_payment_id );
422
  }
423
 
424
+ /**
425
+ * Check if the order has an active Mollie order
426
+ *
427
+ * @param int $order_id
428
+ *
429
+ * @return bool
430
+ */
431
+ public function hasActiveMollieOrder( $order_id ) {
432
+ $mollie_payment_id = $this->getActiveMollieOrderId( $order_id );
433
+
434
+ return ! empty( $mollie_payment_id );
435
+ }
436
+
437
  /**
438
  * @param int $order_id
439
  * @param string $payment_id
557
 
558
  }
559
 
560
+ /**
561
+ * Process a refund if supported
562
+ * @param int $order_id
563
+ * @param float $amount
564
+ * @param string $reason
565
+
566
+ * @since WooCommerce 2.2
567
+ */
568
+ public function refund( $order, $order_id, $amount = null, $reason = '' ) {
569
+
570
+ }
571
+
572
  /**
573
  * @return bool
574
  */
includes/mollie/wc/payment/order.php CHANGED
@@ -75,6 +75,14 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
75
  'order_id' => $order->id,
76
  ),
77
  );
 
 
 
 
 
 
 
 
78
  } else {
79
 
80
  // Setup billing and shipping objects
@@ -82,28 +90,30 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
82
  $shippingAddress = new stdClass();
83
 
84
  // Get user details
85
- $billingAddress->givenName = $order->get_billing_first_name();
86
- $billingAddress->familyName = $order->get_billing_last_name();
87
- $billingAddress->email = $order->get_billing_email();
88
 
89
  // Get user details
90
- $shippingAddress->givenName = $order->get_shipping_first_name();
91
- $shippingAddress->familyName = $order->get_shipping_last_name();
92
- $shippingAddress->email = $order->get_billing_email(); // WooCommerce doesn't have a shipping email
93
 
94
  // Create billingAddress object
95
- $billingAddress->streetAndNumber = $order->get_billing_address_1();
96
- $billingAddress->postalCode = $order->get_billing_postcode();
97
- $billingAddress->city = $order->get_billing_city();
98
- $billingAddress->region = $order->get_billing_state();
99
- $billingAddress->country = $order->get_billing_country();
 
100
 
101
  // Create shippingAddress object
102
- $shippingAddress->streetAndNumber = $order->get_shipping_address_1();
103
- $shippingAddress->postalCode = $order->get_shipping_postcode();
104
- $shippingAddress->city = $order->get_shipping_city();
105
- $shippingAddress->region = $order->get_shipping_state();
106
- $shippingAddress->country = $order->get_shipping_country();
 
107
 
108
  // Generate order lines for Mollie Orders
109
  $order_lines_helper = Mollie_WC_Plugin::getOrderLinesHelper( self::$shop_country, $order );
@@ -123,7 +133,6 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
123
  ),
124
  'locale' => $payment_locale,
125
  'billingAddress' => $billingAddress,
126
- 'shippingAddress' => $shippingAddress,
127
  'metadata' => array (
128
  'order_id' => $order->get_id(),
129
  'order_number' => $order->get_order_number(),
@@ -131,8 +140,21 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
131
  'lines' => $order_lines['lines'],
132
  'orderNumber' => $order->get_order_number(), // TODO David: use order number or order id?
133
  );
 
 
 
 
 
 
 
134
  }
135
 
 
 
 
 
 
 
136
  if ( $store_customer ) {
137
  $paymentRequestData['payment']['customerId'] = $customer_id;
138
  }
@@ -155,7 +177,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
155
 
156
  public function getMolliePaymentIdFromPaymentObject() {
157
 
158
- // TODO David: Quick fix, there needs to be a better way to do this!
159
  $payment = $this->getPaymentObject($this->data->id);
160
 
161
  if ( isset( $payment->_embedded->payments{0}->id ) ) {
@@ -169,9 +191,12 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
169
 
170
  public function getMollieCustomerIdFromPaymentObject() {
171
 
172
- if ( isset( $this->data->_embedded->payments{0}->customerId ) ) {
 
 
 
173
 
174
- return $this->data->_embedded->payments{0}->customerId;
175
 
176
  }
177
 
@@ -195,7 +220,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
195
  if ( $payment->isPaid() ) {
196
 
197
  // Add messages to log
198
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
199
 
200
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
201
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
@@ -207,7 +232,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
207
  }
208
 
209
  // Add messages to log
210
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for order ' . $order_id );
211
 
212
  $order->add_order_note( sprintf(
213
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
@@ -223,7 +248,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
223
  $this->unsetCancelledMolliePaymentId( $order_id );
224
 
225
  // Add messages to log
226
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' processing paid order via Mollie plugin fully completed for order ' . $order_id );
227
 
228
  // Subscription processing
229
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
@@ -243,7 +268,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
243
  } else {
244
 
245
  // Add messages to log
246
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' payment at Mollie not paid, so no processing for order ' . $order_id );
247
 
248
  }
249
  }
@@ -265,7 +290,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
265
  if ( $payment->isAuthorized() ) {
266
 
267
  // Add messages to log
268
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
269
 
270
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
271
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
@@ -278,7 +303,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
278
  }
279
 
280
  // Add messages to log
281
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for order ' . $order_id );
282
 
283
  $order->add_order_note( sprintf(
284
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
@@ -294,7 +319,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
294
  $this->unsetCancelledMolliePaymentId( $order_id );
295
 
296
  // Add messages to log
297
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' processing order status update via Mollie plugin fully completed for order ' . $order_id );
298
 
299
  // Subscription processing
300
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
@@ -315,7 +340,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
315
  } else {
316
 
317
  // Add messages to log
318
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' order at Mollie not authorized, so no processing for order ' . $order_id );
319
 
320
  }
321
  }
@@ -337,7 +362,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
337
  if ( $payment->isCompleted() ) {
338
 
339
  // Add messages to log
340
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
341
 
342
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
343
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
@@ -350,7 +375,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
350
  }
351
 
352
  // Add messages to log
353
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for order ' . $order_id );
354
 
355
  $order->add_order_note( sprintf(
356
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
@@ -366,7 +391,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
366
  $this->unsetCancelledMolliePaymentId( $order_id );
367
 
368
  // Add messages to log
369
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' processing order status update via Mollie plugin fully completed for order ' . $order_id );
370
 
371
  // Subscription processing
372
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
@@ -386,7 +411,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
386
  } else {
387
 
388
  // Add messages to log
389
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' order at Mollie not completed, so no further processing for order ' . $order_id );
390
 
391
  }
392
  }
@@ -407,7 +432,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
407
  }
408
 
409
  // Add messages to log
410
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
411
 
412
  $this->unsetActiveMolliePayment( $order_id, $payment->id );
413
  $this->setCancelledMolliePaymentId( $order_id, $payment->id );
@@ -489,7 +514,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
489
  }
490
 
491
  // Add messages to log
492
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
493
 
494
  // If WooCommerce Subscriptions is installed, process this failure as a subscription, otherwise as a regular order
495
  if ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order_id ) ) {
@@ -521,7 +546,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
521
  );
522
  }
523
 
524
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', renewal order payment failed, order set to On-Hold for shop-owner review.' );
525
 
526
 
527
  // Send a "Failed order" email to notify the admin
@@ -558,7 +583,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
558
  }
559
  }
560
 
561
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', regular order payment failed.' );
562
 
563
  }
564
 
@@ -579,11 +604,11 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
579
  }
580
 
581
  // Add messages to log
582
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
583
 
584
  // Check that this payment is the most recent, based on Mollie Payment ID from post meta, do not cancel the order if it isn't
585
  if ( $mollie_payment_id != $payment->id ) {
586
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', not processed because of a newer pending payment ' . $mollie_payment_id );
587
 
588
  $order->add_order_note( sprintf(
589
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
75
  'order_id' => $order->id,
76
  ),
77
  );
78
+
79
+ // Add sequenceType for subscriptions first payments
80
+ if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
81
+ if ( Mollie_WC_Plugin::getDataHelper()->isSubscription( $order->id ) ) {
82
+ $paymentRequestData['payment']['sequenceType'] = 'first';
83
+ }
84
+ }
85
+
86
  } else {
87
 
88
  // Setup billing and shipping objects
90
  $shippingAddress = new stdClass();
91
 
92
  // Get user details
93
+ $billingAddress->givenName = ( ctype_space( $order->get_billing_first_name() ) ) ? null : $order->get_billing_first_name();
94
+ $billingAddress->familyName = ( ctype_space( $order->get_billing_last_name() ) ) ? null : $order->get_billing_last_name();
95
+ $billingAddress->email = ( ctype_space( $order->get_billing_email() ) ) ? null : $order->get_billing_email();
96
 
97
  // Get user details
98
+ $shippingAddress->givenName = ( ctype_space( $order->get_shipping_first_name() ) ) ? null : $order->get_shipping_first_name();
99
+ $shippingAddress->familyName = ( ctype_space( $order->get_shipping_last_name() ) ) ? null : $order->get_shipping_last_name();
100
+ $shippingAddress->email = ( ctype_space( $order->get_billing_email() ) ) ? null : $order->get_billing_email(); // WooCommerce doesn't have a shipping email
101
 
102
  // Create billingAddress object
103
+ $billingAddress->streetAndNumber = ( ctype_space( $order->get_billing_address_1() ) ) ? null : $order->get_billing_address_1();
104
+ $billingAddress->streetAdditional = ( ctype_space( $order->get_billing_address_2() ) ) ? null : $order->get_billing_address_2();
105
+ $billingAddress->postalCode = ( ctype_space( $order->get_billing_postcode() ) ) ? null : $order->get_billing_postcode();
106
+ $billingAddress->city = ( ctype_space( $order->get_billing_city() ) ) ? null : $order->get_billing_city();
107
+ $billingAddress->region = ( ctype_space( $order->get_billing_state() ) ) ? null : $order->get_billing_state();
108
+ $billingAddress->country = ( ctype_space( $order->get_billing_country() ) ) ? null : $order->get_billing_country();
109
 
110
  // Create shippingAddress object
111
+ $shippingAddress->streetAndNumber = ( ctype_space( $order->get_shipping_address_1() ) ) ? null : $order->get_shipping_address_1();
112
+ $shippingAddress->streetAdditional = ( ctype_space( $order->get_shipping_address_2() ) ) ? null : $order->get_shipping_address_2();
113
+ $shippingAddress->postalCode = ( ctype_space( $order->get_shipping_postcode() ) ) ? null : $order->get_shipping_postcode();
114
+ $shippingAddress->city = ( ctype_space( $order->get_shipping_city() ) ) ? null : $order->get_shipping_city();
115
+ $shippingAddress->region = ( ctype_space( $order->get_shipping_state() ) ) ? null : $order->get_shipping_state();
116
+ $shippingAddress->country = ( ctype_space( $order->get_shipping_country() ) ) ? null : $order->get_shipping_country();
117
 
118
  // Generate order lines for Mollie Orders
119
  $order_lines_helper = Mollie_WC_Plugin::getOrderLinesHelper( self::$shop_country, $order );
133
  ),
134
  'locale' => $payment_locale,
135
  'billingAddress' => $billingAddress,
 
136
  'metadata' => array (
137
  'order_id' => $order->get_id(),
138
  'order_number' => $order->get_order_number(),
140
  'lines' => $order_lines['lines'],
141
  'orderNumber' => $order->get_order_number(), // TODO David: use order number or order id?
142
  );
143
+
144
+ // Add sequenceType for subscriptions first payments
145
+ if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
146
+ if ( Mollie_WC_Plugin::getDataHelper()->isSubscription( $order->get_id() ) ) {
147
+ $paymentRequestData['payment']['sequenceType'] = 'first';
148
+ }
149
+ }
150
  }
151
 
152
+ // Only add shippingAddress if all required fields are set
153
+ if ( isset( $shippingAddress->streetandNumber ) && isset( $shippingAddress->postalCode ) && isset( $shippingAddress->city ) && isset( $shippingAddress->country ) ) {
154
+ $paymentRequestData['shippingAddress'] = $shippingAddress;
155
+ }
156
+
157
+ // Only store customer at Mollie if setting is enabled
158
  if ( $store_customer ) {
159
  $paymentRequestData['payment']['customerId'] = $customer_id;
160
  }
177
 
178
  public function getMolliePaymentIdFromPaymentObject() {
179
 
180
+ // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
181
  $payment = $this->getPaymentObject($this->data->id);
182
 
183
  if ( isset( $payment->_embedded->payments{0}->id ) ) {
191
 
192
  public function getMollieCustomerIdFromPaymentObject() {
193
 
194
+ // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
195
+ $payment = $this->getPaymentObject($this->data->id);
196
+
197
+ if ( isset( $payment->_embedded->payments{0}->customerId ) ) {
198
 
199
+ return $payment->_embedded->payments{0}->customerId;
200
 
201
  }
202
 
220
  if ( $payment->isPaid() ) {
221
 
222
  // Add messages to log
223
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
224
 
225
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
226
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
232
  }
233
 
234
  // Add messages to log
235
+ Mollie_WC_Plugin::debug( __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for order ' . $order_id );
236
 
237
  $order->add_order_note( sprintf(
238
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
248
  $this->unsetCancelledMolliePaymentId( $order_id );
249
 
250
  // Add messages to log
251
+ Mollie_WC_Plugin::debug( __METHOD__ . ' processing paid order via Mollie plugin fully completed for order ' . $order_id );
252
 
253
  // Subscription processing
254
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
268
  } else {
269
 
270
  // Add messages to log
271
+ Mollie_WC_Plugin::debug( __METHOD__ . ' payment at Mollie not paid, so no processing for order ' . $order_id );
272
 
273
  }
274
  }
290
  if ( $payment->isAuthorized() ) {
291
 
292
  // Add messages to log
293
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
294
 
295
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
296
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
303
  }
304
 
305
  // Add messages to log
306
+ Mollie_WC_Plugin::debug( __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for order ' . $order_id );
307
 
308
  $order->add_order_note( sprintf(
309
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
319
  $this->unsetCancelledMolliePaymentId( $order_id );
320
 
321
  // Add messages to log
322
+ Mollie_WC_Plugin::debug( __METHOD__ . ' processing order status update via Mollie plugin fully completed for order ' . $order_id );
323
 
324
  // Subscription processing
325
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
340
  } else {
341
 
342
  // Add messages to log
343
+ Mollie_WC_Plugin::debug( __METHOD__ . ' order at Mollie not authorized, so no processing for order ' . $order_id );
344
 
345
  }
346
  }
362
  if ( $payment->isCompleted() ) {
363
 
364
  // Add messages to log
365
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
366
 
367
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
368
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
375
  }
376
 
377
  // Add messages to log
378
+ Mollie_WC_Plugin::debug( __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for order ' . $order_id );
379
 
380
  $order->add_order_note( sprintf(
381
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
391
  $this->unsetCancelledMolliePaymentId( $order_id );
392
 
393
  // Add messages to log
394
+ Mollie_WC_Plugin::debug( __METHOD__ . ' processing order status update via Mollie plugin fully completed for order ' . $order_id );
395
 
396
  // Subscription processing
397
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
411
  } else {
412
 
413
  // Add messages to log
414
+ Mollie_WC_Plugin::debug( __METHOD__ . ' order at Mollie not completed, so no further processing for order ' . $order_id );
415
 
416
  }
417
  }
432
  }
433
 
434
  // Add messages to log
435
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
436
 
437
  $this->unsetActiveMolliePayment( $order_id, $payment->id );
438
  $this->setCancelledMolliePaymentId( $order_id, $payment->id );
514
  }
515
 
516
  // Add messages to log
517
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
518
 
519
  // If WooCommerce Subscriptions is installed, process this failure as a subscription, otherwise as a regular order
520
  if ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order_id ) ) {
546
  );
547
  }
548
 
549
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', renewal order payment failed, order set to On-Hold for shop-owner review.' );
550
 
551
 
552
  // Send a "Failed order" email to notify the admin
583
  }
584
  }
585
 
586
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', regular order payment failed.' );
587
 
588
  }
589
 
604
  }
605
 
606
  // Add messages to log
607
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
608
 
609
  // Check that this payment is the most recent, based on Mollie Payment ID from post meta, do not cancel the order if it isn't
610
  if ( $mollie_payment_id != $payment->id ) {
611
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', not processed because of a newer pending payment ' . $mollie_payment_id );
612
 
613
  $order->add_order_note( sprintf(
614
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
includes/mollie/wc/payment/payment.php CHANGED
@@ -69,6 +69,14 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
69
  'order_id' => $order->id,
70
  ),
71
  );
 
 
 
 
 
 
 
 
72
  } else {
73
 
74
  $payment_description = strtr( $payment_description, array (
@@ -91,6 +99,13 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
91
  'order_id' => $order->get_id(),
92
  ),
93
  );
 
 
 
 
 
 
 
94
  }
95
 
96
  if ( $store_customer ) {
@@ -156,7 +171,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
156
  if ( $payment->isPaid() ) {
157
 
158
  // Add messages to log
159
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for payment ' . $order_id );
160
 
161
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
162
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
@@ -168,7 +183,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
168
  }
169
 
170
  // Add messages to log
171
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for payment ' . $order_id );
172
 
173
  $order->add_order_note( sprintf(
174
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
@@ -184,7 +199,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
184
  $this->unsetCancelledMolliePaymentId( $order_id );
185
 
186
  // Add messages to log
187
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' processing paid payment via Mollie plugin fully completed for order ' . $order_id );
188
 
189
  // Subscription processing
190
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
@@ -205,7 +220,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
205
  } else {
206
 
207
  // Add messages to log
208
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' payment at Mollie not paid, so no processing for order ' . $order_id );
209
 
210
  }
211
 
@@ -226,7 +241,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
226
  }
227
 
228
  // Add messages to log
229
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for payment ' . $order_id );
230
 
231
  $this->unsetActiveMolliePayment( $order_id, $payment->id );
232
  $this->setCancelledMolliePaymentId( $order_id, $payment->id );
@@ -335,7 +350,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
335
  );
336
  }
337
 
338
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', regular payment failed.' );
339
 
340
  }
341
 
@@ -356,11 +371,11 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
356
  }
357
 
358
  // Add messages to log
359
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id );
360
 
361
  // Check that this payment is the most recent, based on Mollie Payment ID from post meta, do not cancel the order if it isn't
362
  if ( $mollie_payment_id != $payment->id ) {
363
- Mollie_WC_Plugin::debug( __CLASS__ . __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', not processed because of a newer pending payment ' . $mollie_payment_id );
364
 
365
  $order->add_order_note( sprintf(
366
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
@@ -433,11 +448,13 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
433
  if ( ! $payment_object ) {
434
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not find active Mollie payment for order ' . $order_id );
435
 
436
- return false;
437
- } elseif ( ! $payment_object->isPaid() ) {
438
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not refund payment ' . $payment_object->id . ' (not paid). Order ' . $order_id );
 
 
439
 
440
- return false;
441
  }
442
 
443
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Create refund - payment: ' . $payment_object->id . ', order: ' . $order_id . ', amount: ' . Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) . $amount . ( ! empty( $reason ) ? ', reason: ' . $reason : '' ) );
69
  'order_id' => $order->id,
70
  ),
71
  );
72
+
73
+ // Add sequenceType for subscriptions first payments
74
+ if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
75
+ if ( Mollie_WC_Plugin::getDataHelper()->isSubscription( $order->id ) ) {
76
+ $paymentRequestData['payment']['sequenceType'] = 'first';
77
+ }
78
+ }
79
+
80
  } else {
81
 
82
  $payment_description = strtr( $payment_description, array (
99
  'order_id' => $order->get_id(),
100
  ),
101
  );
102
+
103
+ // Add sequenceType for subscriptions first payments
104
+ if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
105
+ if ( Mollie_WC_Plugin::getDataHelper()->isSubscription( $order->get_id() ) ) {
106
+ $paymentRequestData['sequenceType'] = 'first';
107
+ }
108
+ }
109
  }
110
 
111
  if ( $store_customer ) {
171
  if ( $payment->isPaid() ) {
172
 
173
  // Add messages to log
174
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for payment ' . $order_id );
175
 
176
  // WooCommerce 2.2.0 has the option to store the Payment transaction id.
177
  $woo_version = get_option( 'woocommerce_version', 'Unknown' );
183
  }
184
 
185
  // Add messages to log
186
+ Mollie_WC_Plugin::debug( __METHOD__ . ' WooCommerce payment_complete() processed and returned to ' . __METHOD__ . ' for payment ' . $order_id );
187
 
188
  $order->add_order_note( sprintf(
189
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
199
  $this->unsetCancelledMolliePaymentId( $order_id );
200
 
201
  // Add messages to log
202
+ Mollie_WC_Plugin::debug( __METHOD__ . ' processing paid payment via Mollie plugin fully completed for order ' . $order_id );
203
 
204
  // Subscription processing
205
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
220
  } else {
221
 
222
  // Add messages to log
223
+ Mollie_WC_Plugin::debug( __METHOD__ . ' payment at Mollie not paid, so no processing for order ' . $order_id );
224
 
225
  }
226
 
241
  }
242
 
243
  // Add messages to log
244
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for payment ' . $order_id );
245
 
246
  $this->unsetActiveMolliePayment( $order_id, $payment->id );
247
  $this->setCancelledMolliePaymentId( $order_id, $payment->id );
350
  );
351
  }
352
 
353
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', regular payment failed.' );
354
 
355
  }
356
 
371
  }
372
 
373
  // Add messages to log
374
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
375
 
376
  // Check that this payment is the most recent, based on Mollie Payment ID from post meta, do not cancel the order if it isn't
377
  if ( $mollie_payment_id != $payment->id ) {
378
+ Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id . ' and payment ' . $payment->id . ', not processed because of a newer pending payment ' . $mollie_payment_id );
379
 
380
  $order->add_order_note( sprintf(
381
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
448
  if ( ! $payment_object ) {
449
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not find active Mollie payment for order ' . $order_id );
450
 
451
+ return new WP_Error( '1', 'Could not find active Mollie payment for order ' . $order_id );
452
+ }
453
+
454
+ if ( ! $payment_object->isPaid() ) {
455
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Can not refund the unpaid payment ' . $payment_object->id . ' for order ' . $order_id );
456
 
457
+ return new WP_Error( '1', 'Can not refund an unpaid payment ' . $payment_object->id . ' for order ' . $order_id );
458
  }
459
 
460
  Mollie_WC_Plugin::debug( __METHOD__ . ' - Create refund - payment: ' . $payment_object->id . ', order: ' . $order_id . ', amount: ' . Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) . $amount . ( ! empty( $reason ) ? ', reason: ' . $reason : '' ) );
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.2';
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.3';
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.2
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.3
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.2
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,28 @@ Automatic updates should work like a charm; as always though, ensure you backup
181
 
182
  == Changelog ==
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  = 5.0.2 - 11-10-2018 =
185
 
186
  IMPORTANT
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.3
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
+
185
+ = 5.0.3 - 01-11-2018 =
186
+
187
+ IMPORTANT
188
+ This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: [PHP & Mollie API v2](https://github.com/mollie/WooCommerce/wiki/PHP-&-Mollie-API-v2).
189
+
190
+ * Fix - Improvements to refunds: better log messages, show errors to shop-manager
191
+ * Fix - Remove option to set a description for payments, the new Orders API does not support this
192
+ * Fix - Update WooCommerce status constants in our plugin (cancelled and refunded)
193
+ * Fix - Make sure customer ID is stored by getting the payment object with all payments embedded
194
+ * Fix - Get and use correct _mollie_payment_id in setActiveMolliePaymentForOrders and setActiveMolliePaymentForSubscriptions
195
+ * Fix - Move adding of sequenceType into payment object
196
+ * Fix - Update Webship Giftcard logo to webshopgiftcard.svg
197
+
198
+ * Fix - Klarna/Orders API: Also send Address Line 2 to Mollie Orders API
199
+ * Fix - Klarna/Orders API: In billing and shipping address check that fields aren't just a space
200
+ * Fix - Klarna/Orders API: Decode HTML entities in product names before sending them to Mollie
201
+ * Fix - Klarna/Orders API: Don't fall back to Payments API if payment method is Klarna
202
+ * Fix - Klarna/Orders API: Only add shipping address if all required fields are present
203
+ * Fix - Klarna/Orders API: Always store Mollie order ID as _mollie_order_id
204
+ * Fix - Klarna/Orders API: Add fallback to getActiveMolliePayment and try to get payment ID from Mollie order if possible
205
+
206
  = 5.0.2 - 11-10-2018 =
207
 
208
  IMPORTANT