myob-oss / accountright_live_api_.net_sdk Goto Github PK
View Code? Open in Web Editor NEWThis is the repo for the MYOB AccountRight Live .Net SDK
License: MIT License
This is the repo for the MYOB AccountRight Live .Net SDK
License: MIT License
There was a sample project available for download from December 2014 for an old version of the SDK.
We built our integration to MYOB AccountRight using that sample, including support for online databases.
After upgrading to the latest SDK due to apparent requirements to access the databases (they added more multi-currency support), our application can no longer access the data from online databases.
We can access the list of company files and connect to a specific company file, but when trying to download data we get "(401) Unauthorized". We are still sending the applicable tokens like we did before, but it does not help. We did have to update the login window to use the new WebView2 control since the old one no longer works.
We tried to follow the limited directions on the MYOB developer site (Cloud Service) (SDK Services) but it did not help. It did mention that more information was forthcoming.
Is there an updated sample project we can review, or specific documentation that shows what we need to do?
Having built our integration code from a previous .SDK we are receiving the following error when importing from the cloud and attempting to authorise the cloud company file:
System.IO.FileLoadException:
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
Subsequently we rebuilt our integration code against your latest .SDK (which states it's dependencies as >= 7.0.1: https://www.nuget.org/packages/MYOB.AccountRight.API.SDK) but received a similar version specific error.
Our product currently uses Newtonsoft.Json.dll is version: 9.0.1.19813 and it seems the version (v7) and code in the .SDK does not support later versions despite this being stated. Our developers queried whether you have the "Specific Version" properties setting set to "true" as in the image below, which would have this effect?
Could you look to re-issue an .SDK compatible with our JSON version (9.0.1.19813) or re-release the current version with the "Specific Version" set to false? We are hoping you may be able to do this in good time for your forthcoming 2018.1.1 release so we can support our shared clients...
Version:
MYOB.AccountRight.API.SDK 2022.4.405
Problem:
When an employee in a MYOB company file has a Quarterly pay frequency in their wage information, the SDK does not cater for this value and deserialization fails.
How to reproduce:
EmployeePayrollDetailsService
to retrieve an EmployeePayrollDetails
response.Associated Pull Request: #190
I am currently having an issue adding a negative invoice line (item sales) into MYOB via SDK.
I have tried adding in the cost of the item and the total of the item as a negative value but when it is pushed to MYOB the values are converted to positive values.
I have also tried putting the item through with a negative quantity which results in a validation error (CommonRules_DecimalMinValue).
What is the recommended way to go about this?
The authentication seems to fail for me if i use the newer versions of Newtonsoft.Json
Hi Team
Unable to get access token from renewtoken function.
It is alway return me
{"error":"invalid_request"}
Request
POST / https://secure.myob.com/oauth2/v1/authorize/
client_id=d777839f2f7-0ef5-47ab-9946-b2e694363192&client_secret=E3bymLRGH25887S4SmQV8258g3fgiU4&refresh_token=bq7R!IAAAAPTFVGdjX_SkUFh2YHkO_Q6t4yLW0_1nSievq6uMm9CXwQAAAAGo8Oh1k0cEc10RKHfNgMHBAgD9w1yCmUBWUP6oIiZo65Q1G5hJLOdrVv5sGP19moEg5xyH0afMI4UPcGtpuky10lxGVL4CFcvdnLKrPDLNiTcVolcmh3JX-hZ&grant_type=refresh_token
Where is the issue
Can you please provide an updated nuget package with fixes for ActivitySlips/TimeSheet. We're still unable to access the ActivitySlip contract with your current nuget package(v. 2018.1.144)
Add this to the readme.md
See the Latest Release Notes:
https://apisupport.myob.com/hc/en-us
This is thrown when an endpoint in a CompanyFile object does not match that of the URI passed in e.g. mismatch in host-names. This check is to ensure that the app does not try to make requests to the wrong company file see blog - Advanced Warning but it will also kick in if you try to send requests to the default end-point which might not be optimal in a multi-hosted API scenario; which is currently being tested.
This normally happens if the application is using a cached CompanyFile object so the initial recourse on receiving this error should be to refresh all cached CompanyFile objects.
We will look to see if we can throw a better exception (more specific to the issue) and/or ignore the hostname as part of the match as the API will reroute calls but it may not be as optimal for the end user.
As title suggest, I would like to see this library migrated to a cross platform compatible solution, .NET Standard.
http://www.appveyor.com/pricing - free for open source
Account Right 2019.2 has been released, but the API looks like its at version 2018.1.
Will there be an update to the SDK?
Using VS2013 as administrator, When I download the Zip, it will not build as the snk file is missing.
I had to remove signing from the projects and correct the asterix at the end of the version numbers in order to build.
When I do build there are numerous warnings one for example is
This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
Can you confirm this (v2018.1.144) is compatible with 2019.4 accountright? We are currently using 2019.2 and being forced to go 2019.4. I can not see any breaking changes in the api release notes
https://apisupport.myob.com/hc/en-us/articles/360001255956-AccountRight-2019-4-Release-Notes
https://apisupport.myob.com/hc/en-us/articles/360001119016-AccountRight-2019-3-Release-Notes
but would like your input..thanks
I'm trying to create connector from MYOB to SQL Server to share data from each other and i encountered some problem:
In AccountRight graphical interface you can choose from 3 options:
If I choose 3rd option Indeterminate and try to load it in my connector program it crashes and i get this error:
"Encountered an operation error (https://api.myob.com/accountright/a4dfe6e4-38ee-4773-a536-284be2fbc047/Contact/EmployeePayrollDetails/)"
Inner Exception:
Error converting value "Indeterminate" to type 'System.Nullable`1[MYOB.AccountRight.SDK.Contracts.Version2.Contact.Gender]'. Path 'Items[4].Gender', line 400, position 32.
System.ArgumentException.Message:
Requested value 'Indeterminate' was not found.
Is there any way i can fix this ? If someone going to enter this option in AccountRight 2015.4 my connector will skip this employee and won't update his data.
Thank you
Sincerely
Gintaras
When using ApiConfiguration to initialize an instance of a service the ApiBaseUrl value provided should be used instead of the URI specified in the Company File. Or, additional details should be added to exceptions to alert users to the mismatch.
Some company files return a DebitSettlementType
value of "NotSet".
API URL: https://ar1.api.myob.com/accountright/[COMPANYFILE]/Purchase/DebitSettlement?$top=1000
It's likely caused by legacy data that doesn't conform to the api spec, and can't be upgraded.
I have been in touch via developer support, and it has been confirmed as a bug.
I will submit a pull request to address the issue, I expect adding "NotSet" to the enum values to be enough to resolve the issue.
There doesn't look to be any tests covering this particular endpoint?
Error converting value "NotSet" to type 'MYOB.AccountRight.SDK.Contracts.Version2.Purchase.DebitSettlementLineType'. Path 'Items[20].Lines[0].Type', line 660, position 26.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at MYOB.AccountRight.SDK.Communication.BaseRequestHandler.ExtractJSonCompressedEntity[TResp](WebResponse response) in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Communication\BaseRequestHandler.cs:line 172
at MYOB.AccountRight.SDK.Communication.BaseRequestHandler.ExtractDetails[T](HttpWebResponse response, String& location, HttpStatusCode& statusCode) in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Communication\BaseRequestHandler.cs:line 152
at MYOB.AccountRight.SDK.Communication.BaseRequestHandler.HandleResponseCallback[T,TResp](IAsyncResult asynchronousResult) in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Communication\BaseRequestHandler.cs:line 122
I am not sure if you consider this an issue (it can be bypassed with a typecast) but
TaxCode.Rate in the API is a Decimal (8,4) in the API but declared as a double in the SDK
Regards,
John.
Hi Guys,
I have integrated MYOB AccountRight with our application and currently in the process of integrating Timesheets.
I found that the MYOB.AccountRight.SDK.Services.Payroll.TimesheetService doesn't have an option to insert new timesheets like in other Services. However, it has a method to Update an existing timesheet.
Can somebody please give me an example to create a timesheet with .Net SDK.
Appreciate any help on this regard.
Thanks,
Dinindu
Using the following code, adding an attachment to a service bill fails with a 404 not found error.
BillAttachmentData billAttachmentData = new BillAttachmentData();
billAttachmentData.OriginalFileName = "test.pdf";
billAttachmentData.FileBase64Content = Convert.ToBase64String(attachment);
BillAttachmentWrapper billAttachmentWrapper = new BillAttachmentWrapper();
billAttachmentWrapper.Attachments = new List<BillAttachmentData>();
billAttachmentWrapper.Attachments.Add(billAttachmentData);
BillAttachmentWrapper returnedData = serviceBillAttachmentService.InsertEx(CompanyFile, transaction.UID, billAttachmentWrapper, Credentials);
When I hit the API from my frontend react app then I get a CORS error
Frontend Code -
const fetchContacts = async () => { const oauthKeyService = keystore; fetch("https://localhost:44326/OAuth/GetContacts", { method: "GET", headers: { 'Content-Type': 'application/json', 'OAuth-Key-Service': JSON.stringify(oauthKeyService) }, }) .then((response) => response.json()) .then((data) => { console.log("Contacts received:", data); setContacts(data); }) .catch((error) => { console.error("Error fetching contacts:", error); }); };
Backend Code -
`
public ActionResult CreateContact(Customer customer)
{
try
{
var oauthKeyServiceJson = HttpContext.Request.Headers["OAuth-Key-Service"];
var keystore = JsonConvert.DeserializeObject(oauthKeyServiceJson);
// Ensure keystore is initialized
if (keystore == null)
{
return new HttpStatusCodeResult(500, "OAuth KeyStore is not initialized.");
}
// Fetch the company file
var cfService = new CompanyFileService(_configuration, null, keystore);
var companyFile = cfService.GetRange().FirstOrDefault(x => new Version(x.ProductVersion) >= new Version("2013.3"));
if (companyFile == null)
{
return new HttpStatusCodeResult(500, "No valid company file found.");
}
// Ensure credentials are valid
var credentials = new CompanyFileCredentials("Administrator", "");
// Create contact service and insert customer
var contactService = new CustomerService(_configuration, null, keystore);
contactService.Insert(companyFile, customer, credentials);
return new HttpStatusCodeResult(201, "Customer created successfully");
}
catch (ApiValidationException ex)
{
Console.WriteLine("Validation Error in CreateContact: " + ex.Message);
return new HttpStatusCodeResult(400, ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("Error in CreateContact: " + ex.Message);
return new HttpStatusCodeResult(500, "An error occurred while creating the customer.");
}
}
`
The CORS Error I am getting for both creating contact and fetching contact
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.