sezzle / sezzle-magento2

Apache License 2.0
5 stars 3 forks source link

Error in Graphql when executing createSezzleCheckout mutation #22

Closed zexperto closed 1 year ago

zexperto commented 1 year ago

When we execute this mutation mutation createSezzleCheckout($cart_id: String!) { action:createSezzleCheckout(input: { cart_id: $cart_id }) { success checkout_url } } We always get "Internal server error" and in the log we have main.ERROR: Sezzle\Sezzlepay\Gateway\Request\Session\OrderRequestBuilder::getPriceObject(): Argument #1 ($amount) must be of type float, null given

we are using Postman to re-produce this issue do you have any idea? in other hand this mutaton is working as expected "createSezzleCustomerOrder"

arijit-sezzle commented 1 year ago

@zexperto Do u mind writing some logs in this function - https://github.com/sezzle/sezzle-magento2/blob/production/Gateway/Request/Session/OrderRequestBuilder.php#L47 and printing the below information?

and check if any of these are coming as null values.

For logging, if you want, you can leverage our logging function - https://github.com/sezzle/sezzle-magento2/blob/production/Helper/Data.php#L98.

zexperto commented 1 year ago

Yes I confirm that I am getting a null quote, I am able to get the $referenceID

From: Arijit @.> Sent: Wednesday, June 14, 2023 12:32 To: @.> Cc: Wisam @.>; @.> Subject: Re: [sezzle/sezzle-magento2] Error in Graphql when executing createSezzleCheckout mutation (Issue #22)

@zexpertohttps://github.com/zexperto Do u mind writing some logs in this function - https://github.com/sezzle/sezzle-magento2/blob/production/Gateway/Request/Session/OrderRequestBuilder.php#L47 and printing the below information?

and check if any of these are coming as null values.

For logging, if you want, you can leverage our logging function - https://github.com/sezzle/sezzle-magento2/blob/production/Helper/Data.php#L98.

— Reply to this email directly, view it on GitHubhttps://github.com/sezzle/sezzle-magento2/issues/22#issuecomment-1591613444, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAWKLUBOK5DEFMFX7EOWPKDXLHRR5ANCNFSM6AAAAAAZFMRIF4. You are receiving this because you were mentioned.Message ID: @.***>

arijit-sezzle commented 1 year ago

@zexperto Can you confirm that the cart_id you are sending to createSezzleCheckout is a valid one and it has an active quote associated with it?

zexperto commented 1 year ago

Yes it is active, if you want I can send you the postman collection to test it

Best Regards Wisam Hakim

From: Arijit @.> Sent: Thursday, June 15, 2023 15:42 To: @.> Cc: Wisam @.>; @.> Subject: Re: [sezzle/sezzle-magento2] Error in Graphql when executing createSezzleCheckout mutation (Issue #22)

@zexpertohttps://github.com/zexperto Can you confirm that the cart_id you are sending to createSezzleCheckout is a valid one and it has an active quote associated with it?

— Reply to this email directly, view it on GitHubhttps://github.com/sezzle/sezzle-magento2/issues/22#issuecomment-1593622479, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAWKLUHT3GXQT5U66TEK7GLXLNQQNANCNFSM6AAAAAAZFMRIF4. You are receiving this because you were mentioned.Message ID: @.***>

arijit-sezzle commented 1 year ago

@zexperto That would be helpful.

arijit-sezzle commented 1 year ago

Seems like we are able to get a successful response by making a slight change for which we will be going to make a release shortly. The change we made is adding success => true in the response of Sezzle/Sezzlepay/Model/GraphQl/Resolver/CreateSezzleCheckout.php:resolve. Please check this recording for reference. Note that, cart_id in the request is the original cart ID instead of the masked quote id is for testing the flow.

From your initial reporting, it looked like some of the required amount values(discount amount, shipping amount, tax amount, total) were null or properly not set. So, I would suggest adding this slight change for now until there is a release from our side and making sure the quote you are generating has the required fields for generating a checkout at our end.

arijit-sezzle commented 1 year ago

We have released version 7.0.10 which has changes around the input fields. Please let us know if you are still facing the issue.

Thanks.

zexperto commented 1 year ago

Thank you @arijit-sezzle , but I am still having the same issue, it looks like the update was done in this file "CreateSezzleCustomerOrder.php" instead of "CreateSezzleCheckout.php"

arijit-sezzle commented 1 year ago

@zexperto Can you provide all the steps you are following from creating a magento checkout, cart to getting the issue?

zexperto commented 1 year ago

@arijit-sezzle I have attached here a postman collection with simple data, please modify the base url and cart ID as well

Seezzle Guest Order.postman_collection.zip

arijit-sezzle commented 1 year ago

@zexperto Thanks. I will go though it and let you know.

arijit-sezzle commented 1 year ago

@zexperto The issue should be fixed in the new release 7.0.11. Please reopen it if you see further issues.

zexperto commented 1 year ago

Thank you @arijit-sezzle , I confirm it is working now Thanks for your fast effort