Not able to get data using MessengerExtensions.requestPaymentCredentials - facebook

Has anyone tried MessengerExtensions.requestPaymentCredentials using the facebook messenger extension sdk (refer documentation) ?
I am trying to call this in my client side javascript code and I am not getting any data. Below code doesn't alert me neither with email nor with error.
Here is my client side javascript code :
window.extAsyncInit = function() {
MessengerExtensions.requestPaymentCredentials(function success(name, email, cardType, cardLastFourDigits, shippingAddress) {
alert("Email" +email);
}, function error(err) {
alert("Messenger Extension error in getting payment credentials" + err);
});
};
Note : I am able to get user profile data using MessengerExtensions.getUserID by similar code.

Related

TRANSACTION_REQUIREMENTS_CHECK not working

Since 2 weeks I trying to figure out how the Transaction Requirement Check is working.
I copy pasted exactely the same exemple you have provided in the documentation which is this one :
app.intent('verify_transaction_requirements', (conv) => {
console.log("am I entering in this intent ?");
conv.ask(new TransactionRequirements({
orderOptions: {
requestDeliveryAddress: false,
},
paymentOptions: {
googleProvidedOptions: {
prepaidCardDisallowed: false,
supportedCardNetworks: ['VISA', 'AMEX'],
// These will be provided by payment processor,
// like Stripe, Braintree, or Vantiv.
tokenizationParameters: {}
}
}
}));
});
When trying this bit of code on my mobile phone, I am receiving an error saying that my application is not responding anymore.
How error, looking at the log, my Google Function seems to send a 200 status code.
No error has been printed at all.
I have also enabled the transactions on Google Action Console.
Do you have an idea about where the problem could come from ?
Regards,
I believe the issue is because the tokenizationParameters field is empty, but it expecting some data.
Try using placeholder information in it's place, or setting up a sandbox payment processor using Stripe or Braintree:
tokenizationParameters: {
tokenizationType: 'PAYMENT_GATEWAY',
parameters: {
"gateway": 'stripe',
"stripe:publishableKey" : "pk_1234",
"stripe:version" : "1.5"
}
},

Not getting the name and other information of my friend who is also using the same app using facebook login

I am trying to fetch the information about my friends who are also logged in (or using) the app using facebook , for that i am using graph api . But i am not getting relevant information . Can anyone please help me out on that .
I went through the facebook developer docs and tried many option but it didn't helped .
//Request
FB.api(
"/{app-id}", // app-id for the application
{
"fields": "context.fields(friends_using_app)"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Using this when i am trying to fetch the information i am getting output like this
Not getting the name and other information of my friend who is also using the same app using facebook login .
This would be the correct code to get all friends who authorized the App too:
FB.api('/me/friends', (response) => {
if (response && !response.error) {
/* handle the result */
}
}

Getting server response code in oracle jet web service call

I am calling a REST Webservice from Oracle jet ViewModel. The server response as I expected, but how to catch the server response (If the server response is like 400,422). I tried with the following lines of code, but it doesn't seem to be working.
self.User = oj.Model.extend({
urlRoot : self.resourceUrl,
idAttribute : "userId"
});
var user = new self.User();
user.save(
{
success: function(user, response, options) {
console.log("response "+response);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("error thrwos "+errorThrown);
console.log("status "+textStatus);
}
});
All I want to do is, if server response is a success, show the user a success message and navigate to the next page and if the response is an error( 400 or 422 or whatever), show the user an error message ( this can be done using a validator).
Looking at the JSDocs for model.save http://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.Model.html#save
You will see that you can define a callback function to handled the error returned by the save call.
This would work with what #Koshinae is saying in his comment above about options.

Restangular all("customers").getList() does not return result

I started using Restangular to send RESTful requests from my AngularJS app. I have a REST service deployed on http://localhost:20080/v1/customer which produces JSON with customer information.
When I debug AngularJS app it hits a breakpoint in the back-end REST service, however in the browser console it always logs "Failed to find customers with status code 0". Moreover, I never hit the breakpoint in the function that I register as setResponseExtractor.
I also don't see any errors in the console.
When I open http://localhost:20080/v1/customer in the browser I get the following response:
[{"customerInfo":{"name":"My Name","email":"My Email"},"id":"6ca43d0f-94a8-36e8-af3d-963584573d6d"}]
My Restangular code is as follows:
var customerModule = angular.module('customer-module',
['restangular' ]).config(
['RestangularProvider', '$httpProvider',
function (RestangularProvider, $httpProvider)
{
RestangularProvider.setBaseUrl('http://localhost\\:20080/v1');
RestangularProvider.setResponseExtractor(function (response, operation, what) {
return response;
});
...
customerModule.controller('CustomerCtrl',
[ '$scope', 'Restangular', function ($scope, Restangular)
{
var baseCustomers = Restangular.all("customer");
$scope.customers = baseCustomers.getList().then(function (result) {
console.log("Got customers", response.status);
}, function (response) {
console.log("Failed to find customers with status code", response.status);
});
Thoughts?
I'm the creator of Restangular.
You also don't have to add the responseExtractor to the config if you're just returning the response. That's what it does by default.
If you have any other problem, please contact me!
The problem turned out to be with accessing REST services running on a different port than my AngularJS app.
I am moving this thread to AngularJS mailing list - "Problems with a basic $resource.get() call"
Alec

Spotify FB Login with preview api

Anyone knows how the facebook login works with the new preview spotify apps api?
I tried something like this...
require(['$api/facebook'], function(facebook) {
facebook.session.showConnectui();
}
but nothing got me to the result I got with the old api. I also tried to use plain FB js sdk, but the problem is it needs some "url" to allow connections...wich I can't really give out of the spotify app?
Any ideas?
The auth module was not present at first, but now it is part of the Spotify Apps API. You can read more about it on its documentation page. It looks like this:
require(['$api/auth#Auth'], function(Auth) {
var appId = '<your_app_id>',
permissions = ['user_about_me'];
var auth = new Auth();
auth.authenticateWithFacebook(appId, permissions)
.done(function(params) {
if (params.accessToken) {
console.log('Your access token: ' + params.accessToken);
} else {
console.log('No access token returned');
}
}).fail(function(req, error) {
console.error('The Auth request failed with error: ' + error);
});
}
});
In addition, there is a working example in the Tutorial App on GitHub.