itemSummary.getItemData() returns null occasionally - yodlee

I'm using the java API version 10.2. Here's how I obtain the ItemSummary:
DataExtent dataExtent = new DataExtent();
dataExtent.setStartLevel(0);
dataExtent.setEndLevel(Integer.MAX_VALUE);
ItemSummary itemSummary =
Util.getDataService().getItemSummaryForItem1(myContext,
new Long(myItemId), dataExtent);
itemSummary is returned with a 0 status and the correct containerType of BANK. But itemSummary.getItemData() is sometimes null. I say sometimes because if I use the same itemId after a period of time, getItemData() is no longer null (which it should't be). There seem to be an issue if I perform a removeService, addService and getItemData() in quick succession. Any thoughts?

When you do addService yodlee has to go to the bank's website and grab the data. Hence until yodlee has the data you will not have anything in ItemData.
You can call the isItemRefreshing API which will tell you if the item added has finished refreshing and once it does, then if you get the itemSummay and if the item was successfully refreshed then itemData should not be null

Related

Wit.ai seems to be jumping randomly between stories

I have two separate simple stories on my Wit.ai bot,
the first one takes in the word "Debug", sends "test" then runs a function that outputs context stuff to the console called test_context()
the second one takes in an address, runs a function that changes the context called new_session(), then sends a confirmation of the change to the user structured like "your location has been changed to {address}"
when I type directly into the wit.ai test console it seems to correctly detect the stories and run the corresponding functions, but when I try to use it through the Node.js API it seems to act completely randomly.
Sometimes when typing in an address it will run test_context() followed by new_session(), then output no text, sometimes it will just output the test text followed by the address text and run no functions, sometimes it will act correctly.
The same behavior happens when inputting "Debug" as well.
The back end is set up correctly, as 2 other stories seem to be working perfectly fine.
Both of these stories were working fine earlier today, I have made no changes to the wit stories themselves and no change to the back-end has even touched the debug function.
Is this a known issue?
I encountered this problem as well.
It appears to me as when you do not handle setting context variables in the story from wit.ai correctly (by setting them to null for example), it messes up the story. As a developer it is your own responsability to handle the story correctly "client side", so I can understand wit.ai lets weird stuff happen when you do not do this. Maybe wit.ai decided to jump stories to keep their bot from crashing, still remains a bit mysterious to me. Maybe your problem is of a different kind, just sharing a similair observation and my solution.
Exactly for reasons of testing I created three stories;
handle greetings
tell what the weather in city x is
identify when you want to plan a meeting
The bot is connected to facebook and I handle actions (like planning a meeting) on my nodejs express server.
I said to the bot "I want to plan a meeting tomorrow", resulting in a wit date/time. One timeslot by the way. This is going ok. Then I sent the message "I want to plan a meeting this morning". This resulted in TWO date/time variables in the wit.ai context. In turn, my code could not handle this; two timestamps resulted in null (probably json message getting more complicated and I try to get the wrong field). This in turn resulted in null for the context variable that had to be returned.
So what I did is to catch the error for when the context variable is not filled and just fill in [wit.js could not find date]. This fixed the problem, even though I now of course need to handle this error better.
Old code:
'createAppointment': ({sessionId, context, text, entities}) => {
return new Promise(function(resolve, reject) {
const myDateTime = firstEntityValue(entities, 'datetime');
console.log('the time trying to send ',myDateTime);
createAppointment(context, myDateTime)
context.appointmentText = myDateTime
return resolve(context);
},}
New, working code:
'createAppointment': ({sessionId, context, text, entities}) => {
return new Promise(function(resolve, reject) {
const myDateTime = firstEntityValue(entities, 'datetime');
console.log('the time trying to send ',myDateTime);
if(myDateTime){
createAppointment(context, myDateTime)
context.appointmentText = myDateTime
return resolve(context);
} else {
context.appointmentText = '[wit.js could not find date]'
return resolve(context);
}
});
},
Hope this helps

Twitter API followers/ids - All Followers Returned but next_cursor is still present

I have been working with the Twitter API [followers/ids] for a few of our accounts but recent got stuck with a confusing state.
Usually twitter returns a next_cursor when there are still some records remaining in next page(s). It works fine with iteration but recently when I tried to request followers/ids for one of our accounts which doesn't have a lot of followers (just over 4200) and all can be returned in single request. Even though, the API returns all the followers in a single request but strangely the next_cursor is still present.
So when I try to make another (2nd) request with that cursor, only one record is returned which is not present in the first set of records.
What should I consider that how much followers the user actually have?
Total Followers: 4224
1st Request: 4224 [next_cursor: present]
2nd Request with cursor: 1
This is creating confusion as it is 4224 or 4225?
Attaching a screenshot

Can I set variable monthly payment amounts through PayPal REST API's billing plan/agreement? On existing agreements?

I entered this as an issue on the PayPal-PHP-SDK github but it's rather time sensitive at this point.
Our goal is a subscription service that monthly charges users a value they select for each content update during that month. A $1 subscriber would pay $8 if there were 8 updates, for example.
Our implementation so far (which is already live with a number of subscribers) is using the PayPal-PHP-SDK / REST API to create a Billing Plan for each subscriber with a payment definition set to an amount calculated to be the maximum potential monthly charge. I then expected to be able to use Agreement->setBalance() to lower the value to the actual intended charge and then Agreement->billBalance() to process the payment.
Unfortunately due to time pressures we launched without verifying this was a viable implementation, and I've discovered that those functions are only for unpaid/delinquent balances. The start_date on our plans is April 1, and we'll have had 4 content releases but we're set to charge our subscribers for the maximum possible 9 updates.
I've tried a variety of Agreement->update() and Plan->update() calls to change the monthly value, along the lines of:
$Patch = new PayPal\Api\Patch();
$Patch->setOp("replace")
->setPath("/payment_definitions/0/amount/value")
->setValue($patch_value);
$PatchRequest = new PayPal\Api\PatchRequest();
$PatchRequest->addPatch($Patch);
$Plan = PayPal\Api\Plan::get($plan_id, $apiContext);
$Plan->update($PatchRequest, $apiContext);
which returns an exception with "validation_error: Invalid Path provided". Attempts to json encode the data path, up to and including the entire Plan object with $Patch->setPath("/") instead give an exception with "MALFORMED_REQUEST - Incoming JSON request does not map to API request". I suspect most values cannot be updated on an executed agreement or activated plan.
However, I see through the merchant account's website that the monthly value can be manually updated, so I hold out hope that I'm simply going about my API requests the wrong way.
I've also tried creating a Payment object with Transaction->setPurchaseUnitReferenceId($AgreementId) since I'd read something about reference transactions being a potential solution, but I'm getting the same malformed request error:
$Item = new PayPal\Api\Item();
$Item->setCategory('DIGITAL')
->setPrice($pledge_value)
->setDescription($update_name);
$ItemList = new PayPal\Api\ItemList();
$ItemList->addItem($Item);
$Amount = new PayPal\Api\Amount();
$Amount->setCurrency('USD')
->setTotal($pledge_value);
$Transaction = new PayPal\Api\Transaction();
$Transaction->setPurchaseUnitReferenceId($AgreementId)
->setDescription($update_name)
->setAmount($Amount)
->setItemList($ItemList)
->setNotifyUrl($notify_url);
$Payer = new PayPal\Api\Payer();
$Payer->setPaymentMethod('paypal');
$RedirectUrls = new PayPal\Api\RedirectUrls();
$RedirectUrls->setReturnUrl($return_url)
->setCancelUrl($cancel_url);
$Payment = new PayPal\Api\Payment();
$Payment->setIntent('sale')
->setPayer($Payer)
->setRedirectUrls($RedirectUrls)
->addTransaction($Transaction);
$Payment->create($apiContext);
So is there a way to fix our current implementation and plans/agreements? Failing that, is there a REST API solution that I should have used / can try to migrate to? I'd like to avoid Classic API if possible.

I am trying to use Yodlee/executeUserSearchRequest as a RESTful request and need an answer on how to call

I am working with the Yodlee services in c# and using the RESTful api. So far I have successfully connected and logged in with my CobrandSession and UserSessionToken in the development environment. I used the sample apps provided in c# and with some advice from shreyans i got an app working. What I got working was
1) Get YodleeAuthentication
2) Get UserAuthentication
3) Get ItemSummaries
I am now trying to get the full transaction details for each of the Items (i.e. collections of accounts that are an Item)
reading the Docs here https://developer.yodlee.com/Indy_FinApp/Aggregation_Services_Guide/REST_API_Reference/executeUserSearchRequest it states that I need to call executeUserSearchRequest and then paginate through the results using the getUserTransactions. So I am stuck at this point. I dont really want a search which has parameters I just want ALL transactions for this account that I can see.
However, I am using the variables as defined in that page :-
var request = new RestRequest("/jsonsdk/TransactionSearchService/executeUserSearchRequest", Method.POST);
request.AddParameter("cobSessionToken", param.CobSessionToken);
request.AddParameter("userSessionToken", param.UserSessionToken);
request.AddParameter("transactionSearchRequest.containerType", param.ContainerType);
request.AddParameter("transactionSearchRequest.higherFetchLimit", param.HigherFetchLimit);
request.AddParameter("transactionSearchRequest.lowerFetchLimit", param.LowerFetchLimit);
request.AddParameter("transactionSearchRequest.resultRange.endNumber", param.EndNumber);
request.AddParameter("transactionSearchRequest.resultRange.startNumber", param.StartNumber);
request.AddParameter("transactionSearchRequest.searchFilter.currencyCode", param.CurrencyCode);
request.AddParameter("transactionSearchRequest.searchFilter.postDateRange.fromDate", param.FromDate);
request.AddParameter("transactionSearchRequest.searchFilter.postDateRange.toDate", param.ToDate);
request.AddParameter("transactionSearchRequest.searchFilter.transactionSplitType.splitType", param.SplitType);
request.AddParameter("transactionSearchRequest.ignoreUserInput", param.IgnoreUserInput);
request.AddParameter("transactionSearchRequest.searchFilter.itemAcctId", param.ItemAcctId);
var response = RestClientUtil.GetBase().Execute(request);
var content = response.Content;
return new YodleeServiceResultDto(content);
As per the response from shreyans in this posting Getting Error "Any one of [**] of transactionSearchFilter cannot be NULL OR Invalid Values I am not putting in the ClientId and the ClientName
The documentation doesn't specify the format of the dates but the example seems to tell me that its american date format. And specifies a parameter saying IgnoreUserinput, but doesnt have a parameter for user input so this is confusing
When I make a call using this format I get an error response
var getSearchResult = yodleeExecuteUserSearchRequest.Go(yodleeExecuteUserSearchRequestDto);
getSearchResult.Result="
{"errorOccured":"true","exceptionType":"Exception Occured","refrenceCode":"_60ecb1d7-a4c4-4914-b3cd-49182518ca5d"}"
But I get no error message in this and I have no idea what I have done wrong or where to look up this error, can somebody who has used Yodlee REST Api point me in the right direction as I need to get this researched quickly....
thanks your your help, advice, corrections and pointers....
Here is the list of parameters which you can try
1) For a specific ItemAccountId all transactions
transactionSearchRequest.containerType=all
transactionSearchRequest.higherFetchLimit=500
transactionSearchRequest.lowerFetchLimit=1
transactionSearchRequest.resultRange.startNumber=1
transactionSearchRequest.resultRange.endNumber=500
transactionSearchRequest.searchClients.clientId=1
transactionSearchRequest.searchClients.clientName=DataSearchService
transactionSearchRequest.searchFilter.currencyCode=USD
transactionSearchRequest.searchClients=DEFAULT_SERVICE_CLIENT
transactionSearchRequest.ignoreUserInput=true
transactionSearchRequest.ignoreManualTransactions=false
transactionSearchRequest.searchFilter.transactionSplitType=ALL_TRANSACTION
transactionSearchRequest.searchFilter.itemAccountId.identifier=10000353
2) For a Specific account (itemAccountId) with start and end dates
transactionSearchRequest.containerType=all
transactionSearchRequest.higherFetchLimit=500
transactionSearchRequest.lowerFetchLimit=1
transactionSearchRequest.resultRange.startNumber=1
transactionSearchRequest.resultRange.endNumber=500
transactionSearchRequest.searchClients.clientId=1
transactionSearchRequest.searchClients.clientName=DataSearchService
transactionSearchRequest.searchFilter.currencyCode=USD
transactionSearchRequest.searchClients=DEFAULT_SERVICE_CLIENT
transactionSearchRequest.ignoreUserInput=true
transactionSearchRequest.ignoreManualTransactions=false
transactionSearchRequest.searchFilter.transactionSplitType=ALL_TRANSACTION
transactionSearchRequest.searchFilter.itemAccountId.identifier=10000353
transactionSearchRequest.searchFilter.postDateRange.fromDate=08-01-2013
transactionSearchRequest.searchFilter.postDateRange.toDate=10-31-2013

simple_captcha_valid? always returns false

I am using simple_captcha in my rails 3 application. I have a form for requesting quote, But in my controller
if simple_captcha_valid?
always returns false.
The log says it gets null key value
SimpleCaptcha::SimpleCaptchaData Load (1.0ms) SELECT `simple_captcha_data`.* FROM `simple_captcha_data` WHERE `simple_captcha_data`.`key` IS NULL LIMIT 1
Please help..
A little late to the party here, but I ran into the same issue and opened a pull request on the repo to make captcha validation idempotent. Seems the captcha entry is deleted the first time you validate it, which is both surprising and obscured by the code (a predicate method calling a bang method internally). Make sure you're not validating your model more than once and you should be OK.