getting error while deleting user on quickblox - quickblox

How to delete user on quickblox ? I am using javascript sdk.. QB.users.delete(userId,function(err, result){}); I am getting error :- Cannot read property 'external' of undefined

A user can delete himself from the platform using sample code below:
var userId = 1;
QB.users.delete(userId, function(error, result){
});
The error "Cannot read property 'external' of undefined" can mean that the provided id does not exist in the back-end.

Related

How to I get the detail (custom error message) returned with a bad request status code? So that I can do an ASSERT on it

Hi so I am setting up some Integration tests (using Xunit) and I would like to run an Assert to check whether the correct custom error message is returned.
This is the data I need to get is in the following response see image...
detail: "Username must be unique" Don't worry this message will be modified to be more useful later on I am just wanting to get it working first
Required Info
This is the current code...
//Act
response = await _httpClient.PostAsync("CompleteUserSetup", formContent);
//Assert
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode) ; //Bad request should be returned
//TODO: check custom error message is correct
So hoping for...
ASSERT.Equal("Username must be unique", some code to get detail from response)
Okay so I figured out how to get the data I needed. I just needed to convert the result into an object and then I was able to pull the detail data that I needed.
var resultModel = await System.Text.Json.JsonSerializer.DeserializeAsync<Result>(response.Content.ReadAsStream(), JsonSerializerHelper.DefaultDeserialisationOptions);
var errorMessage = resultModel.detail;

Unable to get card details for connected account in Stripe

I am trying to retrieve card details for connected accounts customer, As per stripe documentation we need to pass stripe_account parameter in each api call to work with connected accounts. However in case of retrieving card details it is throwing error for the stripe_account parameter.
Following is how my api call looks like:
\Stripe\Customer::retrieveSource(
'cus_GqzjjKIQXO1JgB',
'card_1GJHkSEyjL72dRjPECxaHlEF',["stripe_account" =>'xxxxxxxxx']
);
Following is the error:
Received unknown parameter: stripe_account
Can someone please help with this.
Thanks
This occurs because of the signature of the retrieveSource method:
public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
In this case the stripe_account is being passed as a param instead of an opt.
You can fix this by passing an empty array for params:
<?php
\Stripe\Stripe::setApiKey('sk_test_xxx');
$ss = \Stripe\Customer::retrieveSource(
'cus_xxx',
'card_xxx',
[],
["stripe_account" => 'acct_xxx']
);
?>
Hope that helps!
v3nkman

Increment Likes in Objective-C / Parse Cloud Code

I am making a social app using Objective-C and Parse. I am trying to write cloud code to increment likes (which is part of the secured User class) upon a button click. This is what I have as of now:
Cloud Code
Parse.Cloud.define("incrementLikes", function(request, response) {
Parse.Cloud.useMasterKey();
var user = new Parse.Object("User");
user.userName = request.params.userName;
user.increment("profilePictureLikes");
});
profilePictureLikes is the name of the database row within the User class that is a number.
Objective-C
- (void)incrementLikes {
[PFCloud callFunctionInBackground:#"incrementLikes" withParameters:#{#"userName": self.user.username}];
}
self.user is the PFUser whose profile is being viewed.
This code generates the following error, and does not increment the likes:
[Error]: success/error was not called (Code: 141, Version: 1.6.2)
Well, the error is because you aren't calling the response handler in the cloud code but you have a number of other issues:
Not calling the response handler
Creating a new user instead of querying to find the existing user
Passing the user name instead of the user object id (see here)
Not saving the user after updating it

Auth::user()-> non-object

I'm trying to retrieve users First Name from the database so I tried something like this in my provider.php controller but the browser error says "Trying to get property of non-object"
$provider = Auth::user()->email;
return View::make('providers.account')
->with('title', 'Account')
->with('provider', $provider);
Any help?
If you are trying to get information for the logged in user, use Ben Dubuisson's answer.
If you are try to get the information for a specified user, do something like:
$provider = User::find($id)->email;
You need to check if user is logged in:
if (Auth::check())
{
$provider = Auth::user()->email;
return View::make('providers.account')
->with('title', 'Artsgap Account')
->with('provider', $provider);
}
otherwise it will return that error (the object doesn;t exist since there is no logged in user)

What is the merchant id?

I'm having issues getting paypal integrated into my windows 8 app. I'm not sure what the "merchantId" is suppose to be, I'm assuming the terminology doesn't line up with what is on the developer portal?
In this code sample, Execute() returns false without showing any prompt:
BuyNow buyNow = new BuyNow([I've tried several ids I found from the portal])
{
UseSandbox = true,
};
ItemBuilder itemBuilder = new ItemBuilder(this.product.Name);
itemBuilder.Description(this.product.Description);
itemBuilder.Name(this.product.Name);
itemBuilder.Price((product.SalePrice ?? product.Price).ToString());
itemBuilder.Quantity(1);
itemBuilder.ID (this.product.Id.ToString());
Item item = itemBuilder.Build();
buyNow.AddItem(item);
bool buyNowResult = await buyNow.Execute();
Alright, for the next person. The 'MerchantId' refers to 'Merchant account ID' which is found on the www.sandbox.paypal.com site under Profile -> My Business Info.
I was also having issues because the string I was entering for the description was too long. Be sure to hook up to the error event to get a meaningful error message. The BuyNow object isn't populated with the error message despite it having an Error property.
buyNow.Error += (sender, e) =>
{
// e has the error
};