Yodlee REST API - error adding new user "Exception Occurred" - javascript

I am trying to use the Yodlee REST API to access our Private Zone and add a new user. I am using the register3 api which I'm calling at
https://sdkint11.yodlee.com/yodsoap/srest/private-XXX/v1.0/jsonsdk/UserRegistration/register3
The dummy user credentials are as follows:
{ cobSessionToken: '10072014_0:58f1876ccc25848a712fade98d9d31c067cb5b4d322094845b4f8359ee59dc2ba01f1e94cfc9d5bd116d32ff6333f84fd848817b9b20cd9b1e85d50774a0ea32',
userCredentials:
{ loginName: 'AAAAAA',
password: 'BBBBBB',
objectInstanceType: 'com.yodlee.ext.login.PasswordCredentials' },
userProfile: { emailAddress: 'ABC#DEF.co.uk' } }
I've changed the credentials a bit for privacy, and for now I'm only using the 5 mandatory arguments required to establish a new user.
The (not very helpful) error I'm getting is
{"errorOccurred":"true","exceptionType":"Exception
Occurred","referenceCode":"_e37c33ab-b59c-4fbc-ab6a-1a2b83f5784f"}
which doesn't help debugging much.
Anyone any ideas?

You are passing the parameters in form of objects which will not be accepted by Yodlee. You will have to strictly follow the way it's represented in the document.
So your request parameter should look like for example -
cobSessionToken: '10072014_0:58f1876ccc220950774a0ea32',
userCredentials.loginName:'AAAAAA', userCredentials.password:'BBBBBB'
Please try out the suggested changes.

Related

Capture Stripe Payment Intent

I am trying to capture a payment intent I have previously created. The payment intent has been set up and confirmed and I am now looking to complete the payment intent with the final amount and transfer the money to a stripe connect user.
const intent = await stripe.paymentIntents.capture({
id: paymentIntentId,
amount_to_capture: finalAmount,
transfer_data:{destination: connectedAccountId,},
});
The above code snippet is what I have so far, I know this is the correct method but I'm getting the following error:
Error: Stripe: Argument "intent" must be a string, but got: [object Object]
It must be to do with how I'm assigning the connect account id. reading the stripe api docs I need to pass the connect account id to the destination field of transfer data.
How should I be passing that in to the nested destination field. My syntax must be wrong.
Here is the stripe documentation for capturing a payment:
Stripe Capture Payment API Documentation
Any help is greatly appreciated.
Are you sure paymentIntentId is in fact an id as a string? From the error, it sounds like this might be a payment intent object and you'd need to use something like paymentIntent.id instead. (paymentIntentId.id as a quick correction, but you should rename the variable to represent its contents).
Double check the value of paymentIntentId -- it's probably different than you expect.
Update: This is due to a misreading of the syntax. The payment intent id is the first argument as a string, with the options in an object as a second argument. So then this is what you need:
const intent = await stripe.paymentIntents.capture(
paymentIntentId,
{
amount_to_capture: finalAmount,
transfer_data: { destination: connectedAccountId, },
}
);

Node.js pg-promise Azure function to write to Postgres (timescaleDB)

Azure is driving me mad again. What I try to achieve is that the data that comes in through an Event Hub needs to be written to the database. What I got working thus far is that the data arrives at the Event Hub and that the Azure function is able to post data to the database. I would prefer to do this with Node.JS as the integration seems kind of nice in Azure. The script I use to send some bogus data to the database is as follows:
module.exports = async function (context, eventHubMessages){
const initOptions = {
query(e) {context.log(e.query)},
capSQL: true
//capSQL: true // capitalize all generated SQL
};
const pgp = require('pg-promise')(initOptions);
const db = pgp({
host: '####',
user: '####',
password: '####',
database: 'iotdemo',
port: 5432,
ssl: true
});
// our set of columns, to be created only once (statically), and then reused,
// to let it cache up its formatting templates for high performance:
const cs = new pgp.helpers.ColumnSet(['customer', 'tag', 'value', 'period'], {table: 'testtable'});
// generating a multi-row insert query:
const query = pgp.helpers.insert(JSON.parse(eventHubMessages), cs);
//=> INSERT INTO "tmp"("col_a","col_b") VALUES('a1','b1'),('a2','b2')
// executing the query:
db.none(query);
};
And yes, this is a snippet from somewhere else. The 'eventHubMessages' should contain the payload. A couple of issues that I have had thus far are:
I can send a payload defined within the script or whilst giving it a testing payload, but I cant send the payload of the actual message
pg-promise returns a 202 regardless of whether it fails or not, so debugging is 'blind' at the moment. Any tips on how to get proper logging would be much appreciated.
I used 'capture events' in the event hub instance to capture the actual messages. These were stored in a blob storage. In noticed that the format is Avro. Do I need to peel away at that object to get to the actual array?
The input should look something like this:
[{"customer": duderino, "tag": nice_rug, "value": 10, "period": 163249839}]
I think I have 2 issues:
I dont know how to get meaningful logging out of the Azure function using Node.JS
Something is off about how my payload is coming in.
A more deeper question is, how do I know whether the Azure function is getting the data that it should. I know that the Event Grid gets the data, but there is no throughput. Namespaces are consistent and the Azure Function should be triggered by that namespace and get the input as a string.
I am seriously lost and out of my depth. Apart from the solution I would also appreciate feedback on my request. I am not a pro on StackOverflow and don't want to waste your time.
Regards
Ok, so after some digging I found a few things to resolve the issue. First of all, I was receiving the payload as a string, meaning that I needed it to parse first, before I could make it a callable object. In terms of code its simple, and part of the base functions of node.js
var parsed_payload = JSON.parse(payload_that_is_a_string);
Lastly, to get meaningful logging I found that the PG-Promise module has great support for that, and that this can be configured when loading the module itself. I was particularly interested in errors, so I enabled that option like so:
const initOptions = {
query(e) {console.log(e.query)},
capSQL: true,
//capSQL: true // capitalize all generated SQL
error: function (error, e) {
if (e.cn) {
// A connection-related error;
// console.log("DC:", e.cn);
// console.log("EVENT:", error.message);
}
}
};
That then can be used as a settings object for loading PG-Promise:
const pgp = require('pg-promise')(initOptions);
Thanks for considering my ask for help. I hope this proves useful for anyone out there!
Regards Pieter

Strange error message being returned when creating calendar event

I'm creating a google calendar event using the Node.js Google Client API, I'm requesting a conference be created with the event using the following object:
var conferenceData =
{
createRequest:
{
requestId: uuid(),
conferenceSolutionKey:
{
type: "hangoutsMeet"
}
}
}
I get an error back from the server saying: Error: Invalid conference type value. Which doesn't make any sense, since, according to this documentation hangoutsMeet is an acceptable value:
The possible values are:
"eventHangout" for Hangouts for consumers (http://hangouts.google.com)
"eventNamedHangout" for classic Hangouts for G Suite users (http://hangouts.google.com)
"hangoutsMeet" for Hangouts Meet (http://meet.google.com)
Anybody have any idea why it could be returning that error?
I am facing the same problem at the moment.
I believe it actually comes from the fact that the calendar where you try to insert the event does not accept the "hangoutsMeet" conference call type.
You can check that by using the API to get the calendar setup details, in conferenceProperties.allowedConferenceSolutionTypes:
- https://developers.google.com/calendar/v3/reference/calendars/get
- https://developers.google.com/calendar/v3/reference/calendars#resource
For my particular case, I can observe that the calendar only supports "eventNamedHangout", and "hangoutsMeet" is not listed.
That being said, I have no idea about how to actually make sure the "hangoutsMeet" type is supported by a specific calendar resource.
Edit
It seems that my problem was coming from the fact I was using a GCP service account - in that case what I observe is that only the eventNamedHangout type is supported.
When sending the very same payload to the API with an access_token obtained via the oauth dance, hangoutsMeet becomes available.
I got this working. As per the events docs you referred to, if providing conferenceSolution then at least one entryPoint must also be provided. Otherwise use createRequest:
"Either conferenceSolution and at least one entryPoint, or createRequest is required."
Does your uuid() return a string ?
and try smth like this instead :
const event = {
"conferenceData": {
"createRequest": {
"requestId": "someRandomKey",
"conferenceSolutionKey": {
"type": "hangoutsMeet"
}
}
}
};

Authorizing xAPI interactions through Javascript triggers against my LRS

I've constructed a course in Storyline2, and defined several triggers via javascript as xAPI (tincan) activities.
I have an LRS endpoint link and authorization token, but I'm yet to understand where these credentials should be embedded in order for the whole thing to function properly.
I was given this at another message board:
var tincan = new TinCan({url: window.location.href});
Which of these needs to be replaced by one of the above mentioned? I'm guessing another should be added via "+" after "href".
That example code (which I guess you got from the article I wrote here: http://tincanapi.com/share-statements-between-courses/ ) is envisaging that you will launch the Storyline content from something like an LMS. In that case you will enter the endpoint and authorization details in the LMS settings, and the LMS will pass those to Storyline.
See: http://tincanapi.com/share-statements-between-courses/
If you want to put the details directly in the package, see the example code here: http://rusticisoftware.github.io/TinCanJS/
(included below for convenience)
var lrs;
try {
lrs = new TinCan.LRS(
{
endpoint: "https://cloud.scorm.com/tc/public/",
username: "<Test User>",
password: "<Test Password>",
allowFail: false
}
);
}
catch (ex) {
console.log("Failed to setup LRS object: " + ex);
// TODO: do something with error, can't communicate with LRS
}

How do I access a user's Facebook friends list in Meteor?

I'm new to Meteor development, and I'm having a lot of trouble with this. I found the following guide, which is the closest thing I've found to a solution: http://www.andrehonsberg.com/article/facebook-graph-api-meteor-js
The .getFriends() function here looks promising as well, but I have no experience with this: https://github.com/maxkferg/meteor-facebook-collections/
I implemented the following code in client/config/config.js:
Accounts.ui.config({
requestPermissions: {
facebook: ['email', 'user_friends', 'user_location', 'user_events',
'friends_events', 'friends_location', 'friends_about_me',
'user_status', 'friends_status', 'read_friendlists'],
}
});
This properly generated the request for permissions upon log-in. (I do have an issue, though. I'm getting the following error: "Uncaught Error: Accounts.ui.config: Can't set requestPermissions more than once for facebook," which is odd, since it points to the hidden accounts_ui.js file, which I have no access to. Shouldn't I be able to override this just fine? The guide above has no mention of this error.)
I implemented the rest of the guide's code as well, but nothing seems to be working. Furthermore, the guide seems to implement a button on the screen that causes some aspect of the user's data to be displayed (friends, posts, etc.) in a list. I don't want any sort of display, though; I just want to be able to access the data (an array of Facebook-specific ids for the a given user's friends would be ideal) so that I can use it for various functions in my web app.
Any and all help would be really appreciated!
From your comment I understand, that you only care about user_friends and email.
If you use the package accounts-facebook for Userlogin, you already have the email of the user. For using the login, you must configure the service. You do this serverside on startup (more info):
ServiceConfiguration.configurations.upsert({
{service: "facebook"},
{ $set: {
appId: "XXX",
secret: "XXX",
requestPermissions: ['user_friends'] //here you are requesting the permission to get the user's friends
}
});
The next step would be to get the user's friends.
You could use a package to do it, or you could do it by hand:
First you should check, if the user gave you permission.
Send a Request to the Facebook-API (API):
GET /{user-id}/permissions
Hopefully you will get an object in the form:
{
"data": [
...,
{
"permission": "user_friends",
"status": "granted"
}
]
}
This means, the user gave you permission to get his friends (more info).
In the next step, you query the Graph-API for the friendlists more info:
GET /v2.3/{user-id}/friendlists HTTP/1.1
Host: graph.facebook.com
This will get you all the friendlists of the user. In the last step you can query for all or some of the lists (e.g. 'Close Friends', 'Acquaintances') with more info:
GET /v2.3/{friendlist-id} HTTP/1.1
Host: graph.facebook.com

Categories

Resources