Comments (4)
Hi @lojzatran. This error is actually caused by extension module and thus prevents notification module from adding the interaction, right?
It might be useful in case of 5xx errors to log whole payment and not just payload with actions, wdyt?
from adyen-commercetools.
I tried the action in impex and got this error back:
{
"statusCode": 400,
"message": "The value '{}' is not valid for field 'createdAt'. ",
"errors": [
{
"code": "InvalidField",
"message": "The value '{}' is not valid for field 'createdAt'. ",
"action": {
"action": "addInterfaceInteraction",
"type": {
"typeId": "type",
"key": "ctp-adyen-integration-interaction-notification"
},
"fields": {
"createdAt": {},
"status": "AUTHORISATION",
"notification": "{\"NotificationRequestItem\":{\"additionalData\":{\"expiryDate\":\"10/2020\",\"authCode\":\"39697\",\"cardSummary\":\"1142\"},\"amount\":{\"currency\":\"EUR\",\"value\":495},\"eventCode\":\"AUTHORISATION\",\"eventDate\":\"2019-07-03T19:19:30+02:00\",\"merchantAccountCode\":\"CommercetoolsGmbHDE775\",\"merchantReference\":\"paymentReferenceId\",\"operations\":[\"CANCEL\",\"CAPTURE\",\"REFUND\"],\"paymentMethod\":\"visa\",\"pspReference\":\"853562174370815K\",\"reason\":\"39697:1142:10/2020\",\"success\":\"true\"}}"
}
},
"actionIndex": 1,
"invalidValue": {},
"field": "createdAt"
}
]
}
In the error above, it is indeed 500 error from extension, but I cannot reproduce this behaviour. However, the root cause here is the empty createdAt, which should not be sent at all. Once we solve it, we can check for other errors.
from adyen-commercetools.
I investigated this error on my local machine and found out the following:
- Missing value
{}
forcreatedAt
is just a log issue. We passcreatedAt: new Date()
as an action to ctpClient and somehow when we got an error back, this is being displayed ascreatedAt: {}
. This I solved by passingcreatedAt: new Date().toISOString()
instead. So when we create an action from notification module, we pass the correct date value, but the logging for error just displays it wrong. - The real problem lies in extension module. We got this error:
"Unexpected token , in JSON at position 32518\\\",\\\"stack\\\":\\\"SyntaxError: Unexpected token , in JSON at position 32518\\\\n at JSON.parse (<anonymous>)\\\\n at _getPaymentObject (/app/src/api/payment/payment.controller.js:53:30)
The error is in this line const requestBody = JSON.parse(body)
from this method:
async function _getPaymentObject (request) {
const body = await httpUtils.collectRequestData(request)
try {
const requestBody = JSON.parse(body)
return requestBody.resource.obj
} catch (err) {
throw new Error(`Error during parsing CTP request: '${body}'. Ending the process. `
+ `Error: ${JSON.stringify(serializeError(err))}`)
}
}
So this means that the request does not contain complete JSON and cannot be parsed. However, when I tested on my local, there was no error. I tried multiple times and they all returned correct results.
from adyen-commercetools.
It cannot be reproduced anymore.
from adyen-commercetools.
Related Issues (20)
- Challenge Response Issue with time out offers HOT 2
- Issue with Icelandic(ISK) currency and Adyen not following the ISO standard. HOT 3
- Query about v11 HOT 3
- upgrading to v11 HOT 1
- [QUESTION] Apple pay instant purchase experience HOT 2
- undefined not handled properly HOT 1
- code won't be executed HOT 1
- Add possibility to migrate from v4 to v5 smoothly HOT 1
- Payment Method for ApplePay/GPay HOT 2
- TypeError in notification module. HOT 3
- Inconsistent authorization state in commercetools HOT 7
- "BadRequest: The type with the key 'ctp-adyen-integration-interaction-notification' was not found HOT 2
- Copy "PSP-reference" to the field "interfaceId" HOT 3
- Klarna and Ideal - No authorisation notification (v11.3.0) HOT 3
- Integration assumes prices are always including tax HOT 2
- Future of commercetools-payment-to-order-processor HOT 4
- Default `adyenPaymentMethodsToNames` in config is not localized which causes update payment fails HOT 2
- Add payment method name to payment objects HOT 1
- Notification handler overwrites valid/matching payment object key with PSP number HOT 3
- Commercetools Project Key Fallback Behavior does not support API Gateway payloadFormatVersion 1.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adyen-commercetools.