Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
contact api update for balances, payment terms and batch payments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Hopkins committed Oct 8, 2013
1 parent 744b0da commit 314afcb
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 0 deletions.
19 changes: 19 additions & 0 deletions source/XeroApi/Model/AccountBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XeroApi.Model
{
public class AccountBase
{
public decimal? Outstanding { get; set; }

public decimal? Overdue { get; set; }

public override string ToString()
{
return String.Format("Outstanding: {0:C}, Overdue: {1:C}.", Outstanding ?? 0, Overdue ?? 0);
}
}
}
25 changes: 25 additions & 0 deletions source/XeroApi/Model/Balances.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XeroApi.Model
{
public class Balances
{
public AccountBase AccountsReceivable { get; set; }

public AccountBase AccountsPayable { get; set; }

public override string ToString()
{
StringBuilder sb = new StringBuilder();

sb.AppendFormat("Sales Invoices: {0} ", AccountsReceivable.ToString());

sb.AppendFormat("Bills: {0}", AccountsPayable.ToString());

return sb.ToString();
}
}
}
27 changes: 27 additions & 0 deletions source/XeroApi/Model/BatchPayments.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XeroApi.Model
{
public class BatchPayments
{
public string BankAccountNumber { get; set; }
public string BankAccountName { get; set; }
public string Details { get; set; }

public override string ToString()
{
StringBuilder sb = new StringBuilder();

sb.AppendFormat("Bank Account Number: {0} ", BankAccountNumber);

sb.AppendFormat("Bank Account Name: {0} ", BankAccountName);

sb.AppendFormat("Details: {0}", Details);

return sb.ToString();
}
}
}
6 changes: 6 additions & 0 deletions source/XeroApi/Model/Contact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public class Contact : EndpointModelBase

public string DefaultCurrency { get; set; }

public Balances Balances { get; set; }

public BatchPayments BatchPayments { get; set; }

public PaymentTerms PaymentTerms { get; set; }

public override string ToString()
{
return string.Format("Contact:{0}", Name);
Expand Down
39 changes: 39 additions & 0 deletions source/XeroApi/Model/PaymentTermBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XeroApi.Model
{
public class PaymentTermBase
{
public int Day { get; set; }
public string Type { get; set; }
public override string ToString()
{
string suffix;

switch (Day)
{
case 1:
case 21:
case 31:
suffix = "st";
break;
case 2:
case 22:
suffix = "nd";
break;
case 3:
case 23:
suffix = "rd";
break;
default:
suffix = "th";
break;
}

return String.Format("{0}{1} {2}", Day, suffix, Type);
}
}
}
24 changes: 24 additions & 0 deletions source/XeroApi/Model/PaymentTerms.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XeroApi.Model
{
public class PaymentTerms
{
public PaymentTermBase Bills { get; set; }
public PaymentTermBase Sales { get; set; }

public override string ToString()
{
StringBuilder sb = new StringBuilder();

sb.Append("Bills: " + Bills.ToString() + " ");

sb.Append("Sales: " + Sales.ToString());

return sb.ToString();
}
}
}
5 changes: 5 additions & 0 deletions source/XeroApi/XeroApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@
<Compile Include="Exceptions\ApiResponseException.cs" />
<Compile Include="MimeTypes.cs" />
<Compile Include="Model\Account.cs" />
<Compile Include="Model\AccountBase.cs" />
<Compile Include="Model\Address.cs" />
<Compile Include="Model\ApiException.cs" />
<Compile Include="Model\Attachment.cs" />
<Compile Include="Model\Balances.cs" />
<Compile Include="Model\BankTransaction.cs" />
<Compile Include="Model\BatchPayments.cs" />
<Compile Include="Model\BrandingTheme.cs" />
<Compile Include="Model\ContactGroup.cs" />
<Compile Include="Model\CreditNote.cs" />
Expand All @@ -83,6 +86,8 @@
<Compile Include="Model\ModelSerializer.cs" />
<Compile Include="Model\ModelTreeNavigator.cs" />
<Compile Include="Model\Payment.cs" />
<Compile Include="Model\PaymentTermBase.cs" />
<Compile Include="Model\PaymentTerms.cs" />
<Compile Include="Model\Phone.cs" />
<Compile Include="Model\Receipt.cs" />
<Compile Include="Model\Report.cs" />
Expand Down

0 comments on commit 314afcb

Please sign in to comment.