Skip to content

Commit

Permalink
✅ Updated and added invoice tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mschadegg committed Feb 20, 2024
1 parent a95dbab commit 6be3b35
Show file tree
Hide file tree
Showing 8 changed files with 689 additions and 173 deletions.
5 changes: 5 additions & 0 deletions tests/Fixtures/Invoices/draft/book-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"draftInvoice": {
"draftInvoiceNumber": 424
}
}
69 changes: 69 additions & 0 deletions tests/Fixtures/Invoices/draft/book-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"bookedInvoiceNumber": 300,
"orderNumber": 424,
"date": "2024-02-13",
"currency": "DKK",
"exchangeRate": 100.000000,
"netAmount": 500.00,
"netAmountInBaseCurrency": 500.00,
"grossAmount": 625.00,
"grossAmountInBaseCurrency": 625.00,
"vatAmount": 125.00,
"roundingAmount": 0.00,
"remainder": 625.00,
"remainderInBaseCurrency": 625.00,
"dueDate": "2024-02-21",
"paymentTerms": {
"paymentTermsNumber": 1,
"daysOfCredit": 8,
"name": "Netto 8 dage",
"paymentTermsType": "net",
"self": "https://restapi.e-conomic.com/payment-terms/1"
},
"customer": {
"customerNumber": 1,
"self": "https://restapi.e-conomic.com/customers/1"
},
"recipient": {
"name": "John Doe",
"vatZone": {
"name": "Domestic",
"vatZoneNumber": 1,
"enabledForCustomer": true,
"enabledForSupplier": true,
"self": "https://restapi.e-conomic.com/vat-zones/1"
}
},
"notes": {
"heading": "Heading",
"textLine1": "Text line 1",
"textLine2": "Text line 2"
},
"layout": {
"layoutNumber": 14,
"self": "https://restapi.e-conomic.com/layouts/14"
},
"pdf": {
"download": "https://restapi.e-conomic.com/invoices/booked/300/pdf"
},
"lines": [
{
"lineNumber": 1,
"sortKey": 1,
"description": "T-shirt - Size L",
"quantity": 1.00,
"unitNetPrice": 500.00,
"discountPercentage": 0.00,
"unitCostPrice": 800.00,
"vatRate": 25.00000000,
"vatAmount": 125.0000,
"totalNetAmount": 500.00,
"product": {
"productNumber": "1",
"self": "https://restapi.e-conomic.com/products/1"
}
}
],
"sent": "https://restapi.e-conomic.com/invoices/booked/300/sent",
"self": "https://restapi.e-conomic.com/invoices/booked/300"
}
34 changes: 34 additions & 0 deletions tests/Fixtures/Invoices/draft/create-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"currency": "DKK",
"customer": {
"customerNumber": 1
},
"date": "2024-02-13T12:20:18+00:00",
"layout": {
"layoutNumber": 14
},
"paymentTerms": {
"paymentTermsNumber": 1
},
"recipient": {
"name": "John Doe",
"vatZone": {
"vatZoneNumber": 1
}
},
"lines": [
{
"description": "T-shirt - Size L",
"product": {
"productNumber": "1"
},
"quantity": 1,
"unitNetPrice": 500
}
],
"notes": {
"heading": "Heading",
"textLine1": "Text line 1",
"textLine2": "Text line 2"
}
}
79 changes: 79 additions & 0 deletions tests/Fixtures/Invoices/draft/create-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"draftInvoiceNumber": 424,
"soap": {
"currentInvoiceHandle": {
"id": 133
}
},
"templates": {
"bookingInstructions": "https://restapi.e-conomic.com/invoices/drafts/424/templates/booking-instructions",
"self": "https://restapi.e-conomic.com/invoices/drafts/424/templates"
},
"attachment": "https://restapi.e-conomic.com/invoices/drafts/424/attachment",
"lines": [
{
"lineNumber": 1,
"sortKey": 1,
"description": "T-shirt - Size L",
"product": {
"productNumber": "1",
"self": "https://restapi.e-conomic.com/products/1"
},
"quantity": 1.00,
"unitNetPrice": 500.00,
"discountPercentage": 0.00,
"unitCostPrice": 800.00,
"totalNetAmount": 500.00,
"marginInBaseCurrency": -300.00,
"marginPercentage": -60.00
}
],
"date": "2024-02-13",
"currency": "DKK",
"exchangeRate": 100.000000,
"netAmount": 500.000000,
"netAmountInBaseCurrency": 500.00,
"grossAmount": 625.000000,
"grossAmountInBaseCurrency": 625.00,
"marginInBaseCurrency": -300.0000,
"marginPercentage": -60.00,
"vatAmount": 125.000000,
"roundingAmount": 0.00,
"costPriceInBaseCurrency": 800.0000,
"dueDate": "2024-02-21",
"paymentTerms": {
"paymentTermsNumber": 1,
"daysOfCredit": 8,
"name": "Netto 8 dage",
"paymentTermsType": "net",
"self": "https://restapi.e-conomic.com/payment-terms/1"
},
"customer": {
"customerNumber": 1,
"self": "https://restapi.e-conomic.com/customers/1"
},
"recipient": {
"name": "John Doe",
"vatZone": {
"name": "Domestic",
"vatZoneNumber": 1,
"enabledForCustomer": true,
"enabledForSupplier": true,
"self": "https://restapi.e-conomic.com/vat-zones/1"
}
},
"notes": {
"heading": "Heading",
"textLine1": "Text line 1",
"textLine2": "Text line 2"
},
"layout": {
"layoutNumber": 14,
"self": "https://restapi.e-conomic.com/layouts/14"
},
"pdf": {
"download": "https://restapi.e-conomic.com/invoices/drafts/424/pdf"
},
"lastUpdated": "2024-02-13T12:20:00Z",
"self": "https://restapi.e-conomic.com/invoices/drafts/424"
}
208 changes: 208 additions & 0 deletions tests/Fixtures/Invoices/draft/get-collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
{
"collection": [
{
"draftInvoiceNumber": 422,
"externalId": "123456",
"soap": {
"currentInvoiceHandle": {
"id": 131
}
},
"templates": {
"bookingInstructions": "https://restapi.e-conomic.com/invoices/drafts/422/templates/booking-instructions",
"self": "https://restapi.e-conomic.com/invoices/drafts/422/templates"
},
"attachment": "https://restapi.e-conomic.com/invoices/drafts/422/attachment",
"lines": [
{
"lineNumber": 1,
"sortKey": 1,
"description": "Test Vare 1",
"unit": {
"unitNumber": 2,
"name": "Stk.",
"products": "https://restapi.e-conomic.com/units/2/products",
"self": "https://restapi.e-conomic.com/units/2"
},
"product": {
"productNumber": "1",
"self": "https://restapi.e-conomic.com/products/1"
},
"quantity": 1.00,
"unitNetPrice": 1000.00,
"discountPercentage": 0.00,
"unitCostPrice": 800.00,
"totalNetAmount": 1000.00,
"marginInBaseCurrency": 200.00,
"marginPercentage": 20.00
},
{
"lineNumber": 2,
"sortKey": 2,
"description": "Test Vare 2",
"unit": {
"unitNumber": 2,
"name": "Stk.",
"products": "https://restapi.e-conomic.com/units/2/products",
"self": "https://restapi.e-conomic.com/units/2"
},
"product": {
"productNumber": "2",
"self": "https://restapi.e-conomic.com/products/2"
},
"quantity": 2.00,
"unitNetPrice": 850.00,
"discountPercentage": 10.00,
"unitCostPrice": 0.00,
"totalNetAmount": 1530.00,
"marginInBaseCurrency": 1530.00,
"marginPercentage": 100.00
}
],
"date": "2023-12-07",
"currency": "DKK",
"exchangeRate": 100.000000,
"netAmount": 2530.000000,
"netAmountInBaseCurrency": 2530.00,
"grossAmount": 3162.500000,
"grossAmountInBaseCurrency": 3162.50,
"marginInBaseCurrency": 1730.0000,
"marginPercentage": 68.38,
"vatAmount": 632.500000,
"roundingAmount": 0.00,
"costPriceInBaseCurrency": 800.0000,
"dueDate": "2023-12-15",
"paymentTerms": {
"paymentTermsNumber": 1,
"daysOfCredit": 8,
"name": "Netto 8 dage",
"paymentTermsType": "net",
"self": "https://restapi.e-conomic.com/payment-terms/1"
},
"customer": {
"customerNumber": 500000011,
"self": "https://restapi.e-conomic.com/customers/500000011"
},
"recipient": {
"name": "John Doe",
"address": "Teststreet 1",
"zip": "5000",
"city": "Odense C",
"country": "Denmark",
"vatZone": {
"name": "Domestic",
"vatZoneNumber": 1,
"enabledForCustomer": true,
"enabledForSupplier": true,
"self": "https://restapi.e-conomic.com/vat-zones/1"
},
"nemHandelType": "corporateIdentificationNumber",
"cvr": "33362749"
},
"notes": {
"heading": "Test Headline",
"textLine1": "Test Note 1",
"textLine2": "Test Note 2"
},
"references": {
"customerContact": {
"customerContactNumber": 132,
"customer": {
"customerNumber": 500000011,
"self": "https://restapi.e-conomic.com/customers/500000011"
},
"self": "https://restapi.e-conomic.com/customers/500000011/contacts/132"
},
"salesPerson": {
"employeeNumber": 1001,
"self": "https://restapi.e-conomic.com/employees/1001"
},
"vendorReference": {
"employeeNumber": 100,
"self": "https://restapi.e-conomic.com/employees/100"
},
"other": "Test Other reference"
},
"layout": {
"layoutNumber": 14,
"self": "https://restapi.e-conomic.com/layouts/14"
},
"pdf": {
"download": "https://restapi.e-conomic.com/invoices/drafts/422/pdf"
},
"lastUpdated": "2024-02-13T10:44:00Z",
"self": "https://restapi.e-conomic.com/invoices/drafts/422"
},
{
"draftInvoiceNumber": 2,
"soap": {
"currentInvoiceHandle": {
"id": 2
}
},
"templates": {
"bookingInstructions": "https://restapi.e-conomic.com/invoices/drafts/2/templates/booking-instructions",
"self": "https://restapi.e-conomic.com/invoices/drafts/2/templates"
},
"attachment": "https://restapi.e-conomic.com/invoices/drafts/2/attachment",
"date": "2019-12-03",
"currency": "DKK",
"exchangeRate": 100.000000,
"netAmount": 0.000000,
"netAmountInBaseCurrency": 0.00,
"grossAmount": 0.000000,
"grossAmountInBaseCurrency": 0.00,
"marginInBaseCurrency": 0.0000,
"marginPercentage": 0.0,
"vatAmount": 0.000000,
"roundingAmount": 0.00,
"costPriceInBaseCurrency": 0.0000,
"dueDate": "2020-01-30",
"paymentTerms": {
"paymentTermsNumber": 2,
"daysOfCredit": 30,
"name": "Lb. md. 30 dage",
"paymentTermsType": "invoiceMonth",
"self": "https://restapi.e-conomic.com/payment-terms/2"
},
"customer": {
"customerNumber": 4,
"self": "https://restapi.e-conomic.com/customers/4"
},
"recipient": {
"name": "James Smith",
"address": "Teststreet 3",
"zip": "5000",
"city": "Odense",
"country": "DK",
"vatZone": {
"name": "EU",
"vatZoneNumber": 2,
"enabledForCustomer": true,
"enabledForSupplier": true,
"self": "https://restapi.e-conomic.com/vat-zones/2"
}
},
"notes": {
"heading": "Notes",
"textLine1": "Note 1"
},
"layout": {
"layoutNumber": 14,
"self": "https://restapi.e-conomic.com/layouts/14"
},
"pdf": {
"download": "https://restapi.e-conomic.com/invoices/drafts/2/pdf"
},
"lastUpdated": "2021-02-23T11:19:00Z",
"self": "https://restapi.e-conomic.com/invoices/drafts/2"
}
],
"pagination": {
"skipPages": 0,
"pageSize": 20,
"maxPageSizeAllowed": 1000,
"results": 2
},
"self": "https://restapi.e-conomic.com/invoices/drafts?skipPages=0&pageSize=20"
}
Loading

0 comments on commit 6be3b35

Please sign in to comment.