Stripe warning - Unrecognized token creation parameter - stripe-payments

I'm just starting with stripe, and I noticed I get a warning in chrome saying:
Unrecognized token creation parameter parameter: company is not a
recognized parameter. This may cause issues with your integration in
the future.
This is the code.
stripe.createToken("account", {
company: {
name: "bbb",
address: {
line1: "77",
city: "abc",
state: "aa",
postal_code: "e2e"
}
},
tos_shown_and_accepted: true
}).then(function(result) {
debugger;
console.log(result);
});
I'm pretty much following the docs here (step 2)
https://stripe.com/docs/connect/account-tokens
It creates a token OK though.
The docs in the API reference suggest company is an object it should know:
https://stripe.com/docs/api/tokens/create_account

It basically tells you what is wrong.
It says that company is not a parameter that is recognized by that stripe endpoint. It creates the token, but ignores your passed parameter

Related

Is there a way to fix this Mailchimp API error in node?

Is there a way to fix this MailChimp API error in Node.js?
{
type: 'http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/',
title: 'Invalid Resource',
status: 400,
detail: "The resource submitted could not be validated. For field-specific details, see the 'errors' array.",
instance: '95a2824e-4f30-4ce4-8c5e-322859d933e4',
errors: [
{
field: 'members.item:0.status',
message: 'Data presented is not one of the accepted values: subscribed, unsubscribed, cleaned, pending.'
}
]
}
What is the API call the Node app is trying to do? Looks like its trying to add a member to a list, so assuming you are making this request POST /lists/{list_id}/members
The required fields in the body needs to be:
{
"email_address": "",
"status": ""
}
Based on the error message, you are not passing in a status in the POST request. Possible values are the following: "subscribed", "unsubscribed", "cleaned", "pending", or "transactional".

Error: The permission type field is required when creating permission using Google Drive API

I'm trying to share a file using the Google Drive API. I have the file ID and the email to share the file to, but I keep getting an error "The permission type field is required". I've followed all the instructions on the API guide, but nothing seemed to fix this.
I'm calling the following function, and I can't tell why this isn't working. Can someone see what I'm doing wrong please?
function shareFile(id, email) {
gdapi.permissions.create({
fileId: id,
resources: {
role: "reader",
type: "anyone",
emailAddress: email
}
});
}
Thanks!
You want to create a permission with role: "reader" and type: "anyone" using googleapis of Node.js.
You have already been able to get and put values for files in Google Drive using Drive API.
gdapi in your script can be used for creating the permission to the file in Google Drive.
If my understanding is correct, how about this answer?
Modification points:
resources is not used. Please modify resources to resource or requestBody.
If you want to use role: "reader" and type: "anyone", please remove emailAddress: email.
When above points are reflected to your script, it becomes as follows.
Modified script:
function shareFile(id, email) {
gdapi.permissions.create({
fileId: id,
resource: { // Modified
role: "reader",
type: "anyone",
// emailAddress: email // Modified
}
});
}
Note:
In this case, plese use the latest version of googleapis. In the current stage, the latest version is googleapis#47.0.0.
If you want to give role: "reader" to emailAddress: email, please modify as follows.
function shareFile(id, email) {
gdapi.permissions.create({
fileId: id,
resource: { // Modified
role: "reader",
type: "user", // Modified
emailAddress: email
}
});
}
References:
Permissions: create
googleapis for Node.js
If I misunderstood your question and this was not the direction you want, I apologize.

I'm trying to make sense of session, but cannot get any data out of it

Currently using LUIS in a bot that connects to Slack. Right now I'm using interactive messages and trying to respond to user input correctly. When I click an item from the drop down LUIS receives it as a message. I can get the text with session.message.text, however I need to get the callback_id of the attachment as well as the channel it was sent from.
I've used console.log(session) to get an idea of what session looks like. From there I've seen that session.message.sourceEvent contains the data I need, however I can't use indexOf() or contains() to actual extrapolate the data. I've also tried session.message.sourceEvent.Payload but end up getting "[object [Object]]". I've tried searching for documentation on session formatting but to no avail.
Below is a snippet of what is returned when I run console.log(session.message.sourceEvent).
{ Payload:
action_ts: '1513199773.200354',
is_app_unfurl: false,
subtype: 'bot_message',
team: { id: 'T03QR2PHH', domain: 'americanairlines' },
user: { id: 'U6DT58F2T', name: 'john.cerreta' },
message_ts: '1513199760.000073',
attachment_id: '1',
ts: '1513199760.000073' },
actions: [ [Object] ],
callback_id: 'map_selection1',
original_message:
username: 'Rallybot',
response_url: 'https://hooks.slack.com/actions/T03QR2PHH/287444348935/Y6Yye3ijlC6xfmn8qjMK4ttB',
type: 'message',
{ type: 'interactive_message',
channel: { id: 'G6NN0DT88', name: 'privategroup' },
token: 'removed for security',
{ text: 'Please choose the Rally and Slack team you would like to map below.',
bot_id: 'B7WDX03UM',
attachments: [Array],
trigger_id: '285857445393.3841091595.085028141d2b8190b38f1bf0ca47dd88' },
ApiToken: 'removed for security' }
session.message.sourceEvent is a javascript Object, however indexOf or contains are functions of String or Array types.
Any info you required in the object, you should direct use the code <object>.<key> to invoke that value. You can try session.message.sourceEvent.Payload.action_ts for example.
Also, you can use Object.keys(session.message.sourceEvent) to get all the keys in this object.

Missing required field: member

{ errors:
[ { domain: 'global',
reason: 'required',
message: 'Missing required field: member' } ],
code: 400,
message: 'Missing required field: member' }
I get this error when I run the following request:
var request = client.admin.members.insert({
groupKey: "some_group#example.com"
, email: "me#example.com"
});
I was authenticated successfully (I received the access token and so on) but when I execute the request above it callbacks that error.
What member field am I supposed to add?
It works fine in API Explorer using groupKey and email fields.
The documentation at https://developers.google.com/admin-sdk/directory/v1/reference/members/insert for admin.members.insert indicates that it requires a groupKey parameter, but that the body (which the node.js library handles as a separate object) should contain a members object containing the role property. See the API Explorer a the bottom of that page as well.
email is part of the form data. The form data must be passed as object in the second argument:
// create the group insert request
var request = client.admin.members.insert({
groupKey: "some_group#example.com"
}, {
email: "me#example.com"
});

Asana API POST to Tasks leads to Server Error

I'm using node.js and the api key for auth. All my get actions work, and I've been able to post a new project, but new tasks always return 'server error'. Here's the object I'm sending to the /tasks endpoint:
data: {
name: 'Figure this out',
notes: '',
assignee: null,
completed: false,
assignee_status: 'later',
completed_at: null,
due_on: null,
tags: [],
parent: null,
followers: [ { id: 5622986387066 }, { id: 5622895459066 } ],
projects: [ 6156399090409 ],
workspace: 1707039411020
}
Any ideas? I've tried passing those ID values a variety of ways, and I've tried creating a more simple task, always fails with a 'server error' response.
Seems like it's the "parent": null that's causing the unhelpful Server Error, which definitely seems like a bug on our side - I've filed it and will hopefully get time to look into it soon. Trim that out, and it gives you actual error messages.
Just to save you some time: you can't set completed_at or tags, and followers should be just an array of integers ("followers": [ 5622986387066, 5622895459066 ]).
You can set completed: [true/false], and the completed_at will be set to the time at which it was marked complete. Not being able to attach tags to a task is a known issue, and one we're hoping to rectify.
Additionally, it's just a little annoying that the format of a response doesn't map 1-1 to the format for posting/updating. We're hoping to do a pass on the overall design of the API to unify those parts a bit more.

Resources