Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FE User logged in: Diese Zustellmethode kann nicht verwendet werden #6

Closed
janoschbatschi opened this issue Aug 21, 2020 · 6 comments
Closed

Comments

@janoschbatschi
Copy link

There seems to be an issue whenever a FE-user is logged in, after filling the address form following pop-up shows up: "Diese Zustellmethode kann nicht verwendet werden", although the correct one is selcted (see screenshots attached)
Klarna protocol gives an error 500 on action "address update".

This issue can be reproduced with different mail-addresses and contao-members.

Bildschirmfoto 2020-08-21 um 18 13 53

Bildschirmfoto 2020-08-21 um 18 24 21

Bildschirmfoto 2020-08-21 um 18 49 43

@richardhj
Copy link
Owner

Please provide the entire particular log entry (you already screenshoted the log entries)

@janoschbatschi
Copy link
Author

janoschbatschi commented Aug 23, 2020

Thank you for the response! The following three cases all result in a 500 error. Case 1 - Address-Update billing and shipping address AT but preselected shipping option DE, Case 2 billing and shipping address AT and preselected shipping option AT, Case 3 billing and shipping address DE and preselected shipping option DE.

Please let me know if you need further information. Any help is appreciated!

Case 1 - Address-Update:

REQUEST-BODY

{
"order_amount": 15454,
"order_tax_amount": 1549,
"order_lines": [
{
"type": "physical",
"reference": "",
"name": "XXXX",
"quantity": 12,
"unit_price": 748,
"tax_rate": 1300,
"total_amount": 8976,
"total_discount_amount": 0,
"total_tax_amount": 1033
},
{
"type": "physical",
"reference": "",
"name": "XXXX",
"quantity": 6,
"unit_price": 748,
"tax_rate": 1300,
"total_amount": 4488,
"total_discount_amount": 0,
"total_tax_amount": 516
},
{
"type": "shipping_fee",
"name": "Versand (Versand Deutschland)",
"quantity": 1,
"unit_price": 1990,
"tax_rate": 0,
"total_amount": 1990,
"total_discount_amount": 0,
"total_tax_amount": 0
}
],
"billing_address": {
"given_name": "XXXX",
"family_name": "XXXX",
"email": "xxxx@gmx.at",
"title": "Herr",
"street_address": "xxxx 12",
"street_name": "xxxx",
"street_number": "12",
"postal_code": "1234",
"city": "Testcity",
"phone": "+43 1 2345667",
"country": "at"
},
"shipping_address": {
"given_name": "XXXX",
"family_name": "XXXX",
"email": "xxxx@gmx.at",
"title": "Herr",
"street_address": "xxxx 12",
"street_name": "xxxx",
"street_number": "12",
"postal_code": "1234",
"city": "Testcity",
"phone": "+43 1 2345667",
"country": "at"
},
"selected_shipping_option": {
"id": "3",
"name": "Versand Deutschland",
"description": "",
"price": 1990,
"tax_amount": 0,
"tax_rate": 0,
"preselected": false,
"shipping_method": "Postal",
"delivery_details": {}
},
"purchase_currency": "EUR",
"merchant_data": "",
"customer": {
"gender": "male"
},
"locale": "de-AT"
}

RESPONSE-HEADER:

Date: Fri, 21 Aug 2020 16:48:30 GMT
Server: Apache
Cache-Control: no-cache, private
x-powered-by: PHP/7.3.21
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade, strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Set-Cookie: PHPSESSID=8590989af0a01fbe054ee30877cbc535; path=/; httponly
Upgrade: h2
Connection: Upgrade, close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

RESPONSE-BODY:

"\n\n \n <meta charset="UTF-8" />\n <title>An Error Occurred: Internal Server Error</title>\n \n \n

Oops! An Error Occurred

\n

The server returned a "500 Internal Server Error".

\n\n
\n Something is broken. Please let us know what you were doing when this error occurred.\n We will fix it as soon as possible. Sorry for any inconvenience caused.\n
\n \n\n"

Case 2 - Address-Update:
REQUEST-BODY:

{
"order_amount": 5478,
"order_tax_amount": 516,
"order_lines": [
{
"type": "physical",
"reference": "",
"name": "Zweigelt Voll Freude 2016",
"quantity": 6,
"unit_price": 748,
"tax_rate": 1300,
"total_amount": 4488,
"total_discount_amount": 0,
"total_tax_amount": 516
},
{
"type": "shipping_fee",
"name": "Versand (Versand Österreich)",
"quantity": 1,
"unit_price": 990,
"tax_rate": 0,
"total_amount": 990,
"total_discount_amount": 0,
"total_tax_amount": 0
}
],
"billing_address": {
"given_name": "Herbert",
"family_name": "Maier",
"email": "test@test.at",
"title": "Herr",
"street_address": "Hauptplatz 1",
"street_name": "Hauptplatz",
"street_number": "1",
"postal_code": "1234",
"city": "City",
"country": "at"
},
"shipping_address": {
"given_name": "Herbert",
"family_name": "Maier",
"email": "test@test.at",
"title": "Herr",
"street_address": "Hauptplatz 1",
"street_name": "Hauptplatz",
"street_number": "1",
"postal_code": "1234",
"city": "City",
"country": "at"
},
"selected_shipping_option": {
"id": "1",
"name": "Versand Österreich",
"description": "",
"price": 990,
"tax_amount": 0,
"tax_rate": 0,
"preselected": false,
"shipping_method": "Own",
"delivery_details": {}
},
"purchase_currency": "EUR",
"merchant_data": "member=13",
"customer": {
"gender": "male"
},
"locale": "de-AT"
}

RESPONSE-HEADER:

Date: Fri, 21 Aug 2020 16:24:55 GMT
Server: Apache
Cache-Control: no-cache, private
x-powered-by: PHP/7.3.21
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade, strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Set-Cookie: PHPSESSID=419e28348f4504f4ea416de01e08155c; path=/; httponly
Upgrade: h2
Connection: Upgrade, close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

RESPONSE-BODY:
500 - Same response as above

Case 3 - Country-Change:

REQUEST-BODY:

{
"order_amount": 10966,
"order_tax_amount": 1033,
"order_lines": [
{
"type": "physical",
"reference": "",
"name": "XXXXX",
"quantity": 12,
"unit_price": 748,
"tax_rate": 1300,
"total_amount": 8976,
"total_discount_amount": 0,
"total_tax_amount": 1033
},
{
"type": "shipping_fee",
"name": "Versand (Versand Deutschland)",
"quantity": 1,
"unit_price": 1990,
"tax_rate": 0,
"total_amount": 1990,
"total_discount_amount": 0,
"total_tax_amount": 0
}
],
"billing_address": {
"given_name": "xxx",
"family_name": "xxx",
"email": "xxxx@gmx.at",
"title": "Frau",
"country": "de"
},
"shipping_address": {
"given_name": "xxx",
"family_name": "xxx",
"email": "xxx@gmx.at",
"title": "Frau",
"country": "de"
},
"selected_shipping_option": {
"id": "3",
"name": "Versand Deutschland",
"description": "",
"price": 1990,
"tax_amount": 0,
"tax_rate": 0,
"preselected": false,
"shipping_method": "Postal",
"delivery_details": {}
},
"purchase_currency": "EUR",
"merchant_data": "",
"customer": {
"gender": "female"
},
"locale": "de-AT"
}

RESPONSE-HEADER:

Date: Fri, 21 Aug 2020 16:20:53 GMT
Server: Apache
Cache-Control: no-cache, private
x-powered-by: PHP/7.3.21
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade, strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Set-Cookie: PHPSESSID=ec873dc124e909605fd51495cc29ecc4; path=/; httponly
Upgrade: h2
Connection: Upgrade, close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

RESPONSE-BODY:

"\n\n \n <meta charset="UTF-8" />\n <title>An Error Occurred: Internal Server Error</title>\n \n \n

Oops! An Error Occurred

\n

The server returned a "500 Internal Server Error".

\n\n
\n Something is broken. Please let us know what you were doing when this error occurred.\n We will fix it as soon as possible. Sorry for any inconvenience caused.\n
\n \n\n"

@richardhj
Copy link
Owner

It looks like, an error occurred in the Contao installation. Can you provide the log entry from /var/logs/prod....log?

You can also bring Contao in the dev mode (write APP_ENV=dev inside the /.env file) and try again. Using this method, you can read the error message from the Klarna log.

@janoschbatschi
Copy link
Author

janoschbatschi commented Aug 23, 2020

Thanks for the helpful hints! So the problem seems to be that the company is not allowed to be NULL in the address_update callback. This error is thrown even if the company field is filled in.

[2020-08-23 20:44:22] request.INFO: Matched route "richardhj.klarna_checkout.callback.address_update". {"route":"richardhj.klarna_checkout.callback.address_update","route_parameters":{"_scope":"frontend","_token_check":false,"_controller":"richardhj.klarna_checkout.controller.callback.address_update","orderId":"280c5151-36ea-6d37-91de-e9db1cd16345","_route":"richardhj.klarna_checkout.callback.address_update"},"request_uri":"https://xxxx.at/kco/callback/address_update/280c5151-36ea-6d37-91de-e9db1cd16345","method":"POST"} []
[2020-08-23 20:44:22] security.INFO: Attempting SimplePreAuthentication. {"key":"frontend","authenticator":"Contao\CoreBundle\Security\ContaoAuthenticator"} []
[2020-08-23 20:44:22] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\NotNullConstraintViolationException: "An exception occurred while executing 'INSERT INTO tl_iso_address (firstname, lastname, company, postal, city, country, phone, email, street_1, pid, ptable, tstamp, store_id, isDefaultBilling, isDefaultShipping, salutation, street_2) VALUES ('XXX', 'XXX', NULL, '1234', 'City', 'at', '1234556', 'xxxx@gmx.at', 'xxx 12', 100, 'tl_iso_product_collection', 1598208262, 0, '1', '', 'Herr', 'c/o aaaa')': SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'company' cannot be null" at /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 103 {"exception":"[object] (Doctrine\DBAL\Exception\NotNullConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO tl_iso_address (firstname, lastname, company, postal, city, country, phone, email, street_1, pid, ptable, tstamp, store_id, isDefaultBilling, isDefaultShipping, salutation, street_2) VALUES ('XXX', 'XXX', NULL, '7122', 'Gols', 'at', '1234556', 'xxxx@gmx.at', 'xxx 12', 100, 'tl_iso_product_collection', 1598208262, 0, '1', '', 'Herr', 'c/o aaaa')':\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'company' cannot be null at /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:103, Doctrine\DBAL\Driver\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'company' cannot be null at /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:83, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'company' cannot be null at /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:78)"} []

@richardhj
Copy link
Owner

richardhj commented Aug 24, 2020

Kannst du folgende Änderung vornehmen?
/vendor/richardhj/isotope-klarna-checkout/src/Util/UpdateAddressTrait.php Zeile 35 die nachfoglenden Zeilen ersetzen mit diesen hier:

       $address->company    = $data['organization_name'] ?? '';
        $address->firstname  = $data['given_name'] ?? '';
        $address->lastname   = $data['family_name'] ?? '';
        $address->email      = $data['email'] ?? '';
        $address->salutation = $data['title'] ?? '';
        $address->street_1   = $data['street_address'] ?? '';
        $address->street_2   = $data['street_address2'] ?? '';
        $address->postal     = $data['postal_code'] ?? '';
        $address->city       = $data['city'] ?? '';
        $address->country    = $data['country'] ?? '';

dann mal schauen, ob der Fehler immer noch auftaucht.

@janoschbatschi
Copy link
Author

Vielen Dank, das hat den Fehler behoben!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants