How to set TotalAmount for SalesReciept - intuit-partner-platform

I'm using QBO Rest API V3 SDK and trying to create a deposit onto an account. It seems there isn't a deposit transaction anymore, so am trying to use a SalesReciept to do so.
The call is succeeding and the transaction is created however the SalesReciept is returned with a TotalAmount of zero. When I look at the QBO application it shows a 0 Deposit amount as well.
I noticed there was a UnitPrice on the API, but was missing from the SDK, so I hand crafted a web request and it still came back with a 0.
If there is another approach I should take let me know.
var deposit = new SalesReceipt()
{
DepositToAccountRef = new ReferenceType()
{
Value = "1",
name = "MyAccount"
},
TxnDate = transaction.TransactionDate,
TxnDateSpecified = true,
TotalAmt = transaction.Amount,
TotalAmtSpecified = true,
Line = new[]
{
new Line()
{
Amount = transaction.Amount,
AmountSpecified = true,
Description = transaction.DisplayBody,
DetailType = LineDetailTypeEnum.SalesItemLineDetail,
DetailTypeSpecified = true,
AnyIntuitObject = new SalesItemLineDetail()
{
ItemRef = new ReferenceType(){
Value = qboIntegration.IncomeAccountId,
name = GetIncomeAccountName(),
},
Qty = 1,
QtySpecified = true,
TaxInclusiveAmt = transaction.Amount,
TaxInclusiveAmtSpecified = true,
ServiceDate = transaction.TransactionDate,
ServiceDateSpecified = true,
},
}
},
};

I've not tried this using .net sdk. You can try the following ( Ref - SO Thread).
AnyIntuitObject = new SalesItemLineDetail()
{
ItemElementName = ItemChoiceType.UnitPrice,
AnyIntuitObject = amount,
...
},
DetailType = LineDetailTypeEnum.SalesItemLineDetail
To get the correct object structure you can create a salesReceipt from QBO UI(with desired attribute value) and retrieve the same using getById endpoint.
To do the above, you can use the ApiExplorer tool as well.
https://developer.intuit.com/apiexplorer?apiname=V3QBO
Thanks

After contacting quickbooks. It is not possible with the current iteration (V3) of the api. They are considering adding this in the next version.

Related

Dynamic NAV 2018 Web Service: Creating Sales Order Lines gets error "Standard Code Text does not exist...."

In Dynamic NAV 2018, I exposed page Sales Order (id 36) as web service, I'm following some guides to create Sales Order Header and Sales Order Lines, the Header can be created successfully, but the Sales Lines always get error "Standard Code Text does not exist..."
SOWS.Sales_Order_VS_Service testcreateSO = new SOWS.Sales_Order_VS_Service();
testcreateSO.UseDefaultCredentials = true;
SOWS.Sales_Order_VS SOEntity = new SOWS.Sales_Order_VS();
testcreateSO.Create(ref SOEntity);
SOEntity.Sell_to_Customer_No = "44094";
SOEntity.Store_No = "S9003";
SOEntity.Location_Code = "S9003";
testcreateSO.Update(ref SOEntity);
SOEntity.SalesLines = new SOWS.Sales_Order_Line[1];
SOEntity.SalesLines[0] = new SOWS.Sales_Order_Line();
testcreateSO.Update(ref SOEntity);
SOEntity.SalesLines[0].Type = SOWS.Type.Item;
SOEntity.SalesLines[0].TypeSpecified = true;
SOEntity.SalesLines[0].No = "208122";
SOEntity.SalesLines[0].Quantity = 1;
testcreateSO.Update(ref SOEntity);
System.Web.Services.Protocols.SoapException: 'The Standard Text does not exist. Identification fields and values: Code='208122''
Checking in table Sales Lines, a record of new order has been created but Type = 0 (means blank)
Document No_ Line No_ Sell-to Customer No_ Type No_ Location Code Document Type
SO210600017 10000 0 1
Please help
Solution
Instead of using only singe page Sales Order as web service, can expose page Sales Order Line as another web service, so full code as below:
SOWS.Sales_Order_VS_Service testcreateSO = new SOWS.Sales_Order_VS_Service();
testcreateSO.UseDefaultCredentials = true;
SOWS.Sales_Order_VS SOEntity = new SOWS.Sales_Order_VS();
testcreateSO.Create(ref SOEntity);
SOEntity.Sell_to_Customer_No = "44094";
SOEntity.Store_No = "S9003";
SOEntity.Location_Code = "S9003";
testcreateSO.Update(ref SOEntity);
//Using Sales Order Line page as web service from here
SOLinesWS.salesDocumentLines_Service saleslinesSV = new SOLinesWS.salesDocumentLines_Service
{
UseDefaultCredentials = true
};
SOLinesWS.salesDocumentLines saleslines = new SOLinesWS.salesDocumentLines();
saleslines.documentType = SOLinesWS.documentType.Order;
saleslines.documentTypeSpecified = true;
saleslines.documentNumber = SOEntity.No;
saleslines.type = SOLinesWS.type.Item;
saleslines.typeSpecified = true;
saleslines.number = "208122";
saleslines.quantity = 1;
saleslines.quantitySpecified = true;
saleslinesSV.Create(ref saleslines);

Using [google-text-to-speech] v1Beta1 version in c#

Does any one know how to use the V1Beta1 version in c#. It will be a great help if some one can point me to some example. Google has not created a Client for this version.
https://cloud.google.com/text-to-speech/docs/reference/rest/v1beta1/text/synthesize#TimepointType
I had the same problem (for Google.Apis.Texttospeech.v1) and could not find an example anywhere. I pieced it together from some Ruby Api docs, so, this works for me.
How to use Google.Apis.Texttospeech.v1 in C#:
var request = new Google.Apis.Texttospeech.v1.Data.SynthesizeSpeechRequest();
request.AudioConfig = new Google.Apis.Texttospeech.v1.Data.AudioConfig()
{
AudioEncoding = "Linear16" // = WAV, or "MP3", "OGG_OPUS"
};
request.Input = new Google.Apis.Texttospeech.v1.Data.SynthesisInput
{
Text = "Sample Speaker Text" // Or use Ssml = "<speak> Your SSML Text.
</speak>"
};
request.Voice = new Google.Apis.Texttospeech.v1.Data.VoiceSelectionParams
{
LanguageCode = "en-EN",
Name = "en-US-Wavenet-C"
};
var service = new Google.Apis.Texttospeech.v1.TexttospeechService(new
Google.Apis.Services.BaseClientService.Initializer
{
ApplicationName = "My Sample App",
ApiKey = "[Your API Key]"
}
);
var response = service.Text.Synthesize(request).Execute();
using (var output = System.IO.File.Create("audioclip.wav"))
{
var bytes = System.Convert.FromBase64String(response.AudioContent);
output.Write(bytes, 0, bytes.Length);
}

SharePoint 2013 REST API - Post SocialRestPostCreationData

I’m currently working on a small application to push Post to a SharePoint 2013 SiteFeed using the Social.Feed API.
Basic Posts using the following JSON Object structure are working fine but I’m struggling using a Social-Attachment.
As long I’m referencing to the files located somewhere in the internet everything works. Posts will create listitems in micro-feed list with HTTP-Reference to the Files. The Object I'm using is set up like this
var creationInfo = new
{
restCreationData = new
{
__metadata = new { type = "SP.Social.SocialRestPostCreationData" },
ID = array,
creationData = new
{
__metadata = new { type = "SP.Social.SocialPostCreationData" },
Attachment = new
{
__metadata = new { type = "SP.Social.SocialAttachment" },
AttachmentKind = 0,
ContentUri = "https://www.google.com/images/icons/hpcg/ribbon-black_68.png",
Description = "Look at this",
Name = "Test",
Uri = "https://www.google.com/images/icons/hpcg/ribbon-black_68.png"
},
ContentText = text,
UpdateStatusText = false,
}
}
};
Is there a possibility to use a local file instead? - Removing the google paths and using a local path in ContentUri will end up in a BAD-Request error.
I guess that the files has to be uploaded somehow before.
Thanks for you help.
Iki
After some trying we now ended up with the following solution.
Before we create the SocialPost, we upload the picture into an image gallery where all Feed users have access to.
Then we create the post containing a link to the image
-> This will do the trick.

How to use PropertyCriteria on complex property?

I'm new to EPiSERVER. Currently trying to search for a page with a specific property set to a specific value.
I need the property CatalogEntryPoint (a ContentReference) to equal something. Here is the criterea:
PropertyCriteria secCriteria = new PropertyCriteria();
secCriteria.Condition = CompareCondition.Equal;
secCriteria.Name = "CatalogEntryPoint.ID";
secCriteria.Type = PropertyDataType.Number;
secCriteria.Value = currentContent.ContentLink.ID.ToString();
secCriteria.Required = true;
And here is an excerpt from the search index:
{
"CatalogEntryPoint": {
"$type": "EPiServer.Find.Cms.IndexableContentReference, EPiServer.Find.Cms",
"ID$$number": 1073742170,
"WorkID$$number": 0,
"ProviderName$$string": "CatalogContent",
"GetPublishedOrLatest$$bool": false,
"IsExternalProvider$$bool": true,
"___types": [
"EPiServer.Find.Cms.IndexableContentReference",
"EPiServer.Core.ContentReference",
"System.Object",
"System.IComparable",
"EPiServer.Data.Entity.IReadOnly"
]
},
It would seem that the CatalogEntryPoint.ID-notation does not work as I'm getting 0 results. How should I write it?
The PropertyDataType has a ContentReference option. The following should work:
PropertyCriteria secCriteria = new PropertyCriteria();
secCriteria.Condition = CompareCondition.Equal;
secCriteria.Name = "CatalogEntryPoint";
secCriteria.Type = PropertyDataType.ContentReference;
secCriteria.Value = currentContent.ContentLink.ToString();
secCriteria.Required = true;
You could also just do ContentLink.ID.ToString(), the code ContentLink.ToString() preserves the content version I believe.

Post to friends timeline using the feed dialog example c# api

I am trying to post something on my friend's timeline and I keep on getting an error every time i try to do it. the code i am using is below. i wonder if the code is correct? Cause it doesn't work for me. Can you help?
dynamic parameters = new ExpandoObject();
if (!string.IsNullOrEmpty(action.Post.PictureLocalSource))
{
var pictureTracking = GetNextPhotoFromFolder(action.Post.PictureLocalSource);
if (pictureTracking != null)
{
// action.Post.Picture = pictureTracking.FBPictureRef; // org
action.Post.Link = pictureTracking.FBPictureRef;
action.Post.Picture = pictureTracking.TrackingFileName;
parameters.type = "";
}
}
parameters.to = action.FacebookPostTargetID;
//parameters.Add("from", MyFacebookID);
parameters.message=action.Post.Message.Trim();
parameters.link = action.Post.Link;
parameters.picture = action.Post.Picture;
parameters.source = action.Post.Source;
parameters.name = action.Post.Name;
string caption = action.Post.Caption;
if (caption.Length > 200)
caption = caption.Substring(0, 200);
parameters.caption = caption.Trim(); // "Σχετικά με το asfame.gr";
parameters.description=action.Post.Description;
string feedtype = "";
if (action.Type == ActionType.Comments)
feedtype = "comments";
else
feedtype = "feed";
parameters.method = feedtype;
result = Client.Post(parameters);
Facebook has removed the ability to post on friends wall from 6th feb,2013. checkout the official doc here http://developers.facebook.com/roadmap/completed-changes/ under subsection Removing ability to post to friends walls via Graph API from February 6, 2013 changes. Hope it helps.