Skip to content
Browse files

parse Bill.PaidAt as DateTimeOffset

  • Loading branch information...
1 parent 27321e4 commit fce03f66fe61f795bd315e06af11b294b078eb03 Tim Iles committed Mar 24, 2012
View
6 GoCardlessSdk.Tests/WebHooks/Data/Bill.txt
@@ -8,18 +8,18 @@
"status": "paid",
"source_type": "subscription",
"source_id": "KKJ398H8K8",
- "paid_at": "2011-12-01T12:00:00Z",
+ "paid_at": "2011-12-01T12:01:23Z",
"uri": "https://sandbox.gocardless.com/api/v1/bills/AKJ398H8KA"
},
{
"id": "AKJ398H8KB",
"status": "paid",
"source_type": "subscription",
"source_id": "8AKJ398H78",
- "paid_at": "2011-12-09T12:00:00Z",
+ "paid_at": "2011-12-09T23:04:56Z",
"uri": "https://sandbox.gocardless.com/api/v1/bills/AKJ398H8KB"
}
],
- "signature": "a68fbb8bce16dc3daa851043fd602e72955496093cd92f0bf89801a85fb7282d"
+ "signature": "7abaa876a693778e7ce6b49bbb6f39f928b5ae87bbe60455175218998a1a9448"
}
}
View
11 GoCardlessSdk.Tests/WebHooks/WebHooksTests.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
using GoCardlessSdk.WebHooks;
using NUnit.Framework;
@@ -33,14 +34,14 @@ public void Bill_PayloadDeserializesOk()
Assert.AreEqual("paid", payload.Bills[0].Status);
Assert.AreEqual("subscription", payload.Bills[0].SourceType);
Assert.AreEqual("KKJ398H8K8", payload.Bills[0].SourceId);
- Assert.AreEqual("2011-12-01T12:00:00Z", payload.Bills[0].PaidAt);
+ Assert.AreEqual(new DateTimeOffset(new DateTime(2011, 12, 01, 12, 01, 23)), payload.Bills[0].PaidAt);
Assert.AreEqual("https://sandbox.gocardless.com/api/v1/bills/AKJ398H8KA", payload.Bills[0].Uri);
Assert.AreEqual("AKJ398H8KB", payload.Bills[1].Id);
- Assert.AreEqual("paid", payload.Bills[01].Status);
+ Assert.AreEqual("paid", payload.Bills[1].Status);
Assert.AreEqual("subscription", payload.Bills[1].SourceType);
Assert.AreEqual("8AKJ398H78", payload.Bills[1].SourceId);
- Assert.AreEqual("2011-12-09T12:00:00Z", payload.Bills[1].PaidAt);
+ Assert.AreEqual(new DateTimeOffset(new DateTime(2011, 12, 09, 23, 04, 56)), payload.Bills[1].PaidAt);
Assert.AreEqual("https://sandbox.gocardless.com/api/v1/bills/AKJ398H8KB", payload.Bills[1].Uri);
}
@@ -64,7 +65,7 @@ public void PreAuthorization_PayloadDeserializesOk()
Assert.AreEqual("https://sandbox.gocardless.com/api/v1/pre_authorizations/AKJ398H8KBOOO3", payload.PreAuthorizations[0].Uri);
Assert.AreEqual("AKJ398H8KBOOOA", payload.PreAuthorizations[1].Id);
- Assert.AreEqual("cancelled", payload.PreAuthorizations[01].Status);
+ Assert.AreEqual("cancelled", payload.PreAuthorizations[1].Status);
Assert.AreEqual("https://sandbox.gocardless.com/api/v1/pre_authorizations/AKJ398H8KBOOOA", payload.PreAuthorizations[1].Uri);
}
View
6 GoCardlessSdk/WebHooks/GoCardlessRequest.cs
@@ -1,4 +1,6 @@
-namespace GoCardlessSdk.WebHooks
+using System;
+
+namespace GoCardlessSdk.WebHooks
{
public class GoCardlessRequest
{
@@ -19,7 +21,7 @@ public class Bill
public string Status { get; set; }
public string SourceType { get; set; }
public string SourceId { get; set; }
- public string PaidAt { get; set; }
+ public DateTimeOffset PaidAt { get; set; }
public string Uri { get; set; }
}

0 comments on commit fce03f6

Please sign in to comment.
Something went wrong with that request. Please try again.