-
Notifications
You must be signed in to change notification settings - Fork 19
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
Intermittent problem creating order #33
Comments
HI, Rudolf |
Cheers @rudolfl. I'll have a play around and see if there is a way I can highlight the issue better in an error. My main concern is that I do not want to be doing any rounding or mutating of values in the library before passing it off to afterpay. Final price should always be specified by the project so there is not any confusion. I may look into validation, however I tried to leave this to afterpay to do on behalf of the library. |
Hi Jared,
This is fine, but I would suggest at least making a note in documentation
about it.
When it happens, it is intermittent (only affect products with prices not
rounded) and is difficult to track down.
Rudolf
…On Mon, Jul 10, 2017 at 9:29 AM, Jared Fraser ***@***.***> wrote:
Cheers @rudolfl <https://github.com/rudolfl>. I'll have a play around and
see if there is a way I can highlight the issue better in an error.
My main concern is that I do not want to be doing any rounding or mutating
of values in the library before passing it off to afterpay. Final price
should always be specified by the project so there is not any confusion.
I may look into validation, however I tried to leave this to afterpay to
do on behalf of the library.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#33 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACBEujIhc48OyuvMHxCj6x7wEY1UBYW3ks5sMWJVgaJpZM4OPpXk>
.
|
@rudolfl is this the error that your seeing?
Definitely appears to be an issue on afterpay's end. The JSON I am sending is valid
but throws an invalid json error. If i change it to 2 decimal spots I get a correct validation error for missing required fields. |
Yes, this is the problem.
Rudolf
…On Mon, Jul 10, 2017 at 10:57 AM, Jared Fraser ***@***.***> wrote:
@rudolfl <https://github.com/rudolfl> is this the error that your seeing?
CultureKings\Afterpay\Model\ErrorResponse {#154
#errorCode: "invalid_json"
#errorId: "462761d252297eb9"
#message: "The request contains improperly formated JSON"
#httpStatusCode: 400
}
Definitely appears to be an issue on afterpay's end. The JSON I am sending
is valid
{
"consumer": {},
"items": [],
"discounts": [],
"totalAmount": {
"amount": 203.4443,
"currency": "AUD"
},
"merchant": {}
}
but throws an invalid json error. If i change it to 2 decimal spots I get
a correct validation error for missing required fields.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#33 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACBEuldNN_CSlUltu9n1HxFE5Jh4uLCaks5sMXb4gaJpZM4OPpXk>
.
|
Thanks for the report. I have updated the README to point out this issue and given you credit for the bug report. As this lies outside the scope of the library I am going to close the issue now. |
It appears something in your API will need to change. I tried setting 2 decimal places as a string, i tried setting the float to 2 decimal places. But after setAmount() is called on the money object, no matter what I do it seems to send a float with a large amount of decimal places to afterpay. |
@vangar02 can you replicate the issue using postman? |
Not exactly sure how this would help @Jore , because the number becomes a float in the setAmount() method in the CultureKings/AfterPay php API. Sending a number in JSON direct to afterpay with postman would not cause the issue, see Jared's message above. EDIT: Actually, unsure if it happens in the setAmount, or when the json is prepared after that object, before sending to Afterpay. |
Sometimes, following code:
$orderToken = \CultureKings\Afterpay\Factory\MerchantApi::orders($authorization)->create($orderDetails);
returns NULL. No exception, just NULL.
Problem is intermittent and I am trying to find a way to reliably reproduce it. No luck so far, but it pops every now and then.
Any idea what can trigger it?
Additional info -- I found that problem is related when product info is set. Some products trigger the issue.
I tried to break it, but fail to reproduce the problem. Someone who is using module I wrote based on your code is experiencing the fault on certain products. I tried to use his product data (name, SKU, price), but that works for me. Really weird!
Rudolf
The text was updated successfully, but these errors were encountered: