This repository was archived by the owner on Apr 12, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Xero.Api/Core/Model/Types Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ public void can_get_credit_note_as_pdf()
20
20
AssertOk ( PdfEndpointType . CreditNotes , new CreditNotes . Create ( ) . Given_a_creditnote ( ) . Id ) ;
21
21
}
22
22
23
+ [ Test ]
24
+ public void can_get_purchase_order_as_pdf ( )
25
+ {
26
+ AssertOk ( PdfEndpointType . PurchaseOrders , new PurchaseOrders . Create ( ) . Given_a_purchase_order ( ) . Id ) ;
27
+ }
28
+
23
29
[ Test ]
24
30
public void invoice_gives_404_when_not_found ( )
25
31
{
@@ -32,6 +38,12 @@ public void credit_note_gives_404_when_not_found()
32
38
Assert . Throws < NotFoundException > ( ( ) => Api . PdfFiles . Get ( PdfEndpointType . CreditNotes , Guid . NewGuid ( ) ) ) ;
33
39
}
34
40
41
+ [ Test ]
42
+ public void purchase_order_gives_404_when_not_found ( )
43
+ {
44
+ Assert . Throws < NotFoundException > ( ( ) => Api . PdfFiles . Get ( PdfEndpointType . PurchaseOrders , Guid . NewGuid ( ) ) ) ;
45
+ }
46
+
35
47
private void AssertOk ( PdfEndpointType type , Guid id )
36
48
{
37
49
var pdf = Api . PdfFiles . Get ( type , id ) ;
Original file line number Diff line number Diff line change @@ -58,5 +58,27 @@ private Guid ContactId
58
58
return Api . Contacts . Find ( ) . First ( ) . Id ;
59
59
}
60
60
}
61
+
62
+ public PurchaseOrder Given_a_purchase_order ( )
63
+ {
64
+ return Api . PurchaseOrders . Create (
65
+ new PurchaseOrder
66
+ {
67
+ Status = PurchaseOrderStatus . Authorised ,
68
+ Date = DateTime . Today ,
69
+ Contact = new Contact { Id = ContactId } ,
70
+ LineItems = new List < LineItem > ( )
71
+ {
72
+ new LineItem
73
+ {
74
+ Description = "An item I want to purchase" ,
75
+ UnitAmount = 1 ,
76
+ Quantity = 1 ,
77
+
78
+ }
79
+ }
80
+ }
81
+ ) ;
82
+ }
61
83
}
62
84
}
Original file line number Diff line number Diff line change 3
3
public enum PdfEndpointType
4
4
{
5
5
CreditNotes ,
6
- Invoices
6
+ Invoices ,
7
+ PurchaseOrders
7
8
}
8
9
}
You can’t perform that action at this time.
0 commit comments