Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Commit c7da77c

Browse files
authored
Merge pull request #372 from MJMortimer/f-batchpayments
Add BatchPayments functionality
2 parents e73046f + 5cbea0b commit c7da77c

File tree

13 files changed

+181
-4
lines changed

13 files changed

+181
-4
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Xero.Api.Core.Endpoints.Base;
2+
using Xero.Api.Core.Model;
3+
using Xero.Api.Core.Request;
4+
using Xero.Api.Core.Response;
5+
using Xero.Api.Infrastructure.Http;
6+
7+
namespace Xero.Api.Core.Endpoints
8+
{
9+
public interface IBatchPaymentsEndpoint
10+
: IXeroCreateEndpoint<BatchPaymentsEndpoint, BatchPayment, BatchPaymentsRequest, BatchPaymentsResponse>
11+
{
12+
13+
}
14+
15+
public class BatchPaymentsEndpoint
16+
: XeroCreateEndpoint<BatchPaymentsEndpoint, BatchPayment, BatchPaymentsRequest, BatchPaymentsResponse>, IBatchPaymentsEndpoint
17+
{
18+
public BatchPaymentsEndpoint(XeroHttpClient client) :
19+
base(client, "/api.xro/2.0/BatchPayments")
20+
{
21+
}
22+
}
23+
}

Xero.Api/Core/IXeroCoreApi.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public interface IXeroCoreApi
1313
AttachmentsEndpoint Attachments { get; }
1414
IBankTransactionsEndpoint BankTransactions { get; }
1515
IBankTransfersEndpoint BankTransfers { get; }
16+
IBatchPaymentsEndpoint BatchPayments { get; }
1617
IBrandingThemesEndpoint BrandingThemes { get; }
1718
IContactsEndpoint Contacts { get; }
1819
IContactGroupsEndpoint ContactGroups { get; }
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
4+
using Xero.Api.Common;
5+
using Xero.Api.Core.Model.Status;
6+
using Xero.Api.Core.Model.Types;
7+
8+
namespace Xero.Api.Core.Model
9+
{
10+
[DataContract(Namespace = "")]
11+
public class BatchPayment : HasUpdatedDate, IHasId
12+
{
13+
[DataMember(Name = "BatchPaymentID", EmitDefaultValue = false)]
14+
public Guid Id { get; set; }
15+
16+
[DataMember(Name = "Type", EmitDefaultValue = false)]
17+
public BatchPaymentType? Type { get; set; }
18+
19+
[DataMember(Name = "Status", EmitDefaultValue = false)]
20+
public BatchPaymentStatus? Status { get; set; }
21+
22+
[DataMember(Name = "Account")]
23+
public Account Account { get; set; }
24+
25+
[DataMember(Name = "Particulars", EmitDefaultValue = false)]
26+
public string Particulars { get; set; }
27+
28+
[DataMember(Name = "Code", EmitDefaultValue = false)]
29+
public string Code { get; set; }
30+
31+
[DataMember(Name = "Reference", EmitDefaultValue = false)]
32+
public string Reference { get; set; }
33+
34+
[DataMember(Name = "Details", EmitDefaultValue = false)]
35+
public string Details { get; set; }
36+
37+
[DataMember(Name = "Narrative", EmitDefaultValue = false)]
38+
public string Narrative { get; set; }
39+
40+
[DataMember(Name = "Date", EmitDefaultValue = false)]
41+
public DateTime? Date { get; set; }
42+
43+
[DataMember(Name = "Payments")]
44+
public List<BatchPaymentPayment> Payments { get; set; }
45+
46+
[DataMember(Name = "TotalAmount", EmitDefaultValue = false)]
47+
public decimal? Total { get; set; }
48+
49+
[DataMember(Name = "IsReconciled", EmitDefaultValue = false)]
50+
public bool? IsReconciled { get; set; }
51+
}
52+
}

Xero.Api/Core/Model/BatchPayments.cs renamed to Xero.Api/Core/Model/BatchPaymentContactDefaults.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace Xero.Api.Core.Model
55
{
6-
[DataContract(Namespace = "")]
7-
public class BatchPayments : CoreData
6+
[DataContract(Namespace = "", Name = "BatchPayments")]
7+
public class BatchPaymentContactDefaults : CoreData
88
{
99
[DataMember(EmitDefaultValue = false)]
1010
public string BankAccountNumber { get; set; }
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Runtime.Serialization;
3+
using Xero.Api.Common;
4+
5+
namespace Xero.Api.Core.Model
6+
{
7+
[DataContract(Namespace = "", Name = "Payment")]
8+
public class BatchPaymentPayment : CoreData
9+
{
10+
[DataMember(Name = "Invoice")]
11+
public Invoice Invoice { get; set; }
12+
13+
[DataMember(Name = "PaymentID", EmitDefaultValue = false)]
14+
public Guid? PaymentId { get; set; }
15+
16+
[DataMember(Name = "BankAccountNumber", EmitDefaultValue = false)]
17+
public string BankAccountNumber { get; set; }
18+
19+
[DataMember(Name = "Particulars", EmitDefaultValue = false)]
20+
public string Particulars { get; set; }
21+
22+
[DataMember(Name = "Code", EmitDefaultValue = false)]
23+
public string Code { get; set; }
24+
25+
[DataMember(Name = "Reference", EmitDefaultValue = false)]
26+
public string Reference { get; set; }
27+
28+
[DataMember(Name = "Details", EmitDefaultValue = false)]
29+
public string Details { get; set; }
30+
31+
[DataMember(Name = "Narrative", EmitDefaultValue = false)]
32+
public string Narrative { get; set; }
33+
34+
[DataMember(Name = "Amount", EmitDefaultValue = false)]
35+
public decimal? Amount { get; set; }
36+
}
37+
}

Xero.Api/Core/Model/Contact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class Contact : HasUpdatedDate, IHasId, IHasAttachment
8282
public BrandingTheme BrandingTheme { get; set; }
8383

8484
[DataMember(EmitDefaultValue = false)]
85-
public BatchPayments BatchPayments { get; set; }
85+
public BatchPaymentContactDefaults BatchPayments { get; set; }
8686

8787
[DataMember(EmitDefaultValue = false)]
8888
public Balances Balances { get; set; }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace Xero.Api.Core.Model.Status
4+
{
5+
[DataContract(Namespace = "")]
6+
public enum BatchPaymentStatus
7+
{
8+
[EnumMember(Value = "AUTHORISED")]
9+
Authorised,
10+
[EnumMember(Value = "DELETED")]
11+
Deleted
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace Xero.Api.Core.Model.Types
4+
{
5+
[DataContract(Namespace = "")]
6+
public enum BatchPaymentType
7+
{
8+
[EnumMember(Value = "PAYBATCH")]
9+
PayBatch,
10+
[EnumMember(Value = "RECBATCH")]
11+
RecBatch
12+
}
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Runtime.Serialization;
2+
using Xero.Api.Common;
3+
using Xero.Api.Core.Model;
4+
5+
namespace Xero.Api.Core.Request
6+
{
7+
[CollectionDataContract(Namespace = "", Name = "BatchPayments")]
8+
public class BatchPaymentsRequest : XeroRequest<BatchPayment>
9+
{
10+
}
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Collections.Generic;
2+
using Xero.Api.Common;
3+
using Xero.Api.Core.Model;
4+
5+
namespace Xero.Api.Core.Response
6+
{
7+
public class BatchPaymentsResponse : XeroResponse<BatchPayment>
8+
{
9+
public List<BatchPayment> BatchPayments { get; set; }
10+
11+
public override IList<BatchPayment> Values
12+
{
13+
get { return BatchPayments; }
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)