edreyer / freshbooks-api-java-client

Automatically exported from code.google.com/p/freshbooks-api-java-client
0 stars 0 forks source link

Update Client Bug #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I am using a test URL and Key
2. Client client = con.getClient(6L);
3. client.setOrganization("New Organization");
4. con.updateClient(client);

I have put these lines in the main method of DumpAccount.java

What is the expected output? What do you see instead?
Expected Output was to see New Organization as my organization name is 
Freshbooks account.

Instead I got the following error:

com.freshbooks.ApiException: Invalid parameter: links
        at 
com.freshbooks.ApiConnection.performRequest(ApiConnection.java:106)
        at 
com.freshbooks.ApiConnection.updateClient(ApiConnection.java:523)
        at com.freshbooks.test.DumpAccount.main(DumpAccount.java:38)

What version of the product are you using? On what operating system?
I checked out the latest code with the following command
svn checkout http://freshbooks-api-java-client.googlecode.com/svn/trunk/ 
freshbooks-api-java-client-read-only

I am using this on Windows XP

Please provide any additional information below.
I have my app integrated with Paypal and when the customer is done paying 
the amount if I add the payment then it's throwing an error saying You need 
to have enough credit in your account to add the payment.  So I thought of 
adding Credits to the Client object:

So to the Client.java I added

@XStreamAlias("url")
URL url;
@XStreamAlias("credits")
Credits credits;

// Java code for Credits Class 
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.io.Serializable;

@XStreamAlias( "credits" )
public class Credits implements Serializable {

    private static final long serialVersionUID = -242317398728068909L;
    @XStreamAlias( "credit" )
    Double credit;

    public Double getCredit() {
        return credit;
    }

    public void setCredit( Double credit ) {
        this.credit = credit;
    }
}

Not sure if I am right or wrong but it started throwing an exception saying 
there is no URL parameter present and so I add the URL parameter.

Original issue reported on code.google.com by ramsate...@gmail.com on 23 Mar 2010 at 11:29

GoogleCodeExporter commented 8 years ago
Looks like the error is coming back from FreshBooks, maybe make sure you set 
the "links" on the client to null when you send it over, so that the "links" 
XML tag won't be included.

Original comment by dob...@gmail.com on 22 Jun 2010 at 4:48

GoogleCodeExporter commented 8 years ago
Also had this, setting Links and Credits to null fixes the problem. Thanks!

Original comment by azquo...@gmail.com on 7 May 2014 at 8:47