Are there examples of itineraries that are compatible with the Amadeus self-service trip parse API? - amadeus

I've tried booking references from a dozen providers (which I don't want to post for privacy reasons) and every time the API returns 'Unable to parse' but with no additional diagnostic information.
As a self-service API they don't offer support through any channel other than Stack Overflow, but I'm hoping someone has successfully used the endpoint.
I'm mostly using GMail to access sample flight booking emails, then selecting "View Original" to download the original MIME format email
This is what I use to read the .eml file into code:
function base64_encode(file) {
// read binary data
var bitmap = fs.readFileSync(file);
// convert binary data to base64 encoded string
return new Buffer(bitmap).toString('base64');
}
However every single email I submit to the endpoint eventually returns:
data:
{ data:
{ type: 'trip-parser-job',
id: 'REDACTED',
self: [Object],
status: 'ERROR',
detail: 'Unable to parse' } } }
and at this point, I'm starting to think that either the API is broken, or they haven't correctly documented what data should be submitted as content. I've decoded the sample document they provide and can't see any major difference between that and my inputs.
Does someone have either some working samples that the API was able to process, or some NodeJS code which seems to reliably get a result from the API?

Related

Getstream.io throws exception when using the "to" field

I have two flat Feed Groups, main, the primary news feed, and main_topics.
I can make a post to either one successfully.
But when I try to 'cc' the other using the to field, like, to: ["main_topics:donuts"] I get:
code: 17
detail: "You do not have permission to do this, you got this error because there are no policies allowing this request on this application. Please consult the documentation https://getstream.io/docs/"
duration: "0.16ms"
exception: "NotAllowedException"
status_code: 403
Log:
The request didn't have the right permissions or autorization. Please check our docs about how to sign requests.
We're generating user tokens server-side, and the token works to read and write to both groups without to.
// on server
stream_client.user(user.user_id).create({
name: user.name,
username: user.username,
});
Post body:
actor: "SU:5f40650ad9b60a00370686d7"
attachments: {images: [], files: []}
foreign_id: "post:1598391531232"
object: "Newsfeed"
text: "Yum #donuts"
time: "2020-08-25T14:38:51.232"
to: ["main_topics:donuts", "main_topics:all"]
verb: "post"
The docs show an example with to: ['team:barcelona', 'match:1'], and say you need to create the feed groups in the panel, but mention nothing about setting up specific permissions to use this feature.
Any idea why this would happen? Note that I'm trying to create the new topics (donuts, all) which don't exist when this post is made. However, the docs don't specify that feeds need to be explicitly created first - maybe that's the missing piece?
If you haven’t already tried creating the feed first, then try that. Besides that, the default permissions restrict a user from posting on another’s feed. I think it’s acceptable to do this if it’s a notification feed but not user or timeline.
You can email the getstream support to change the default permissions because these are not manageable from the dashboard.
Or you can do this call server side as an admin permissions.

How to receive encrypted payment token data of Google Pay

I'm trying to use Google Pay on my website. Once I confirm the payment Google returns this data structure:
But I need something like this:
{
"signature":"MEYCIQDTe92wpG6OUgxJ/8Qnr36XzSgjGGCM7R3LwxjgwPYMTAIhAJDrjHG9wEm1BxVM6MMMB+jGTGpi3VScEMVbHIUsObFi",
"protocolVersion":"ECv2",
"signedMessage":"{\"encryptedMessage\":\"FY8w/U3IbdsZQovX8ufNGFDOePgc/genRiMjHyvuIBqLY4a6uPz7wI0ra31K6YbFJlAnCjFhTwSvDxAYXw6hlmI8sESO5eM1eZlzfP3+NoKV80OXKvOM/xI/qOQEqpEQEVXx6Bw2EpMMFW8yBaA8XPUNee3EJlUk+/f8lRdRcNmI65QKPLAzUnySo75HzBkSc5It/8/oXdYwR93/K6HRKGZuD+bIaxy3SUvC9ehQqhBoP+A34yQX1knfJ1qjBMhhVVcPZHi+Bg6LXA4ms/lfDdim6D1Epr6XQhc2h4RZ/dT+6Enn81s/8ym+jMMs8kqsW9ib8vkdTARv9AbUu7zeGPrKTCAxwc1n6joRR72dSnNCI9j9sxd9tkuC9wuRyDmjbWT+hRZgLc1v/xzzNImo3NxdKdaPzKBE3t9XQZY5fp3lZELaoXAuxAZYtZ7bX64Mz9c28wD8EM+krvfbmGMiBjIt8EfeH48/SjeaUKfDu+yQnjPJAKbDZPhKJ1jqlY/ChP0Om7spQacT86QUVK/DwfzukwvwwRJkWydNEac5fgfS2T6ToZ+PW4VHbxkDnY/h+B0uwdlNQIL2a3Ar5Q\\u003d\\u003d\",\"ephemeralPublicKey\":\"BGkK4bSvob+e7ZgaNV/4vSJYYa10OJzd3aUk9yPEP6iNBRcfHiD/NTvhKjN4P24l0tEzH3L8TrySl6AczPJpCkw\\u003d\",\"tag\":\"xGEhEfJESIyBSfq2fExWiZxNWelnm3m4i8P7cgsarqg\\u003d\"}"
}
Could you please advice me what should I do to get the second data structure. Thank you!
The response that you are after is found under paymentMethodData.tokenizationData.token. However, the contents of this field are determined by the request parameters that you pass to loadPaymentData. Are you able to include the request that was used to generate the above response?
FYI, the following JSFiddle will produce a result similar to what you are after:
const tokenizationSpecification = {
  type: 'DIRECT',
  parameters: {
    'protocolVersion': 'ECv2',
'publicKey': 'BMzk6xvwPgU8vjB...7KRu4tuRmhm6nv8=',
  }
};
/*
{
"signature":"MEUCI...TougPg",
"protocolVersion":"ECv2",
"signedMessage": "{\"encryptedMessage\":\"VhQuaN...5o0Ny6Y\\u003d\"}"
}
*/
I achieved this by using a DIRECT tokenization specification which is discouraged:
Key Point: The Direct integration allows merchants to decrypt the Google Pay response on their servers. To qualify, you must be Payments Card Industry (PCI) Data Security Standard (DSS) Level 1 compliant. Your servers also need to have the required infrastructure to securely handle users' payment credentials.
Third parties that supply gateway or processing services on behalf of actual merchants aren't eligible to use the Direct integration. For questions about your integration as a payment service provider, contact us.
If you don't meet the necessary prerequisites, we recommend that you use a supported gateway to receive a payment token.
Not sure if this is still an open issue. But here are my 2 cents and might be the answer to your solution.
Please note: This is an answer if you are using WorldPay/Vantiv only.
From your first response above with the token, I believe you are using gateway as "vantiv"
"gateway": "vantiv"
"vantiv:merchantPayPageId": "YOUR_PAY_PAGE_ID"
"vantiv:merchantOrderId": "YOUR_ORDER_ID"
"vantiv:merchantTransactionId": "YOUR_TRANSACTION_ID"
"vantiv:merchantReportGroup": "*web"
If you want to get the second response with signature and signedMessage then all you have to do is change the gateway to "worldpay" and you should get the same response:
"gateway": "worldpay"
"gatewayMerchantId": "YOUR_WORLDPAY_MERCHANT_ID"
You can find the request here

How to get AWS API Gateway to validate JSON Body against Model

The newly released "x-amazon-apigateway-request-validator" (in April I believe) is supposed to be able to run a JSON schema validation against the POST/PUT payload of an API.
I've tried to implement this in several different ways now but I can't make it work...
I have added the validators:
"x-amazon-apigateway-request-validators": {
"ValidateBody": {
"validateRequestParameters": false,
"validateRequestBody": true
},
"ValidateHeaders": {
"validateRequestParameters": true,
"validateRequestBody": false
}
}
For any methind I will look for specific headers so I also have the parameters in the "root" of the Swagger:
"x-amazon-apigateway-request-validator": "ValidateHeaders"
In the POST I have a x-amazon-apigateway-request-validator: ValidateBody and then a Model with the JSON schema where several elements are required.
I can however POST anything as long as it is JSON... There is no validation against the JSON schema done...
What am I missing?
It is working!
There is a time lag between the deploy and the actual usage of the new code even though I am not doing any caching it seems.
Went out for lunch and came back to a working solution!
{
"message": "Invalid request body"
}
It would be nice to be able to modify the response message though...

Outpan API C# POST Request

What does the Outpan server expect when posting data?
GET was giving me a json info that I was able to convert to an object.
Now when I'm giving information back just like the name:
https://api.outpan.com/v2/products/UPCCode/name?apikey=xxx
it will always not understand my information (error 400). Already tried sending the json back with additional info, "Foodname" and "name = Foodname"

Data not being formatted as JSON

I am doing the following in a Facebook Request:
function sendRequests() {
FB.ui({
method: 'apprequests',
message: "You are invited to the surprise Birthday",
data:{"board_id":<%=#board.id%>}
When I get the request object from the user who accepted the application I parse it as a JSON object as follows:
ActiveSupport::JSON.decode(request_body.body)
All of the information is formatted as a Hash should in Rails except for the data I sent in which looks as follows:
"data"=>"{\"board_id\":1}"
I have tried all kinds of combinations but it just won't convert properly. Am I missing something or does the JSON returned by the facebook graph api need to be formatted differently?
Try copying the data and validating it manually here: http://jsonlint.com/
It has helped me numerous times.
In the end I did the following:
In the facebook fb.ui
FB.ui({
method: 'apprequests',
exclude_ids: <%=#invited_guests.map{|guest| guest.provider_user_id} %>,
message: <%="'You are invited to the surprise Birthday board for #{#board.bp_name}'" %>,
title: "Come celebrate with us",
data: "board_id:<%=#board.id%>"
Then in the controller after the request is accepted in facebook:
request_content = ActiveSupport::JSON.decode(request_body.body)
board = ActiveSupport::JSON.decode(request_content["data"])
I have to decode twice. Once for the whole request and the second time for the specific data information passed. It might not be pretty but it works.