diff --git a/src/app/views/receipt.njk b/src/app/views/receipt.njk
index 8015ab8..3eb3028 100644
--- a/src/app/views/receipt.njk
+++ b/src/app/views/receipt.njk
@@ -5,27 +5,29 @@
{% set creationDateValue = order.paid_on %}
{% block invoice_payment_information %}
-
+
Payment details
{% if payments.length > 1 %}
- ({{ payments.length }} {{ ' payment' | pluralise(payments.length) }})
+ ({{ payments.length }} payments)
{% endif %}
{% for payment in payments %}
- {% if payments.length > 1 %}
- Payment {{ loop.index }}
- {% endif %}
+
+ {% if payments.length > 1 %}
+
Payment {{ loop.index }}
+ {% endif %}
- {{ MetaList({
- items: [
- { label: 'Method', value: payment.method | sentenceCase },
- { label: 'Amount received', value: payment.amount | formatCurrency },
- { label: 'Received on', value: payment.received_on, type: 'date' },
- { label: 'Transaction reference', value: payment.transaction_reference }
- ],
- modifier: 'stacked',
- itemModifier: 'stacked'
- }) }}
+ {{ MetaList({
+ items: [
+ { label: 'Method', value: payment.method | sentenceCase },
+ { label: 'Amount received', value: payment.amount | formatCurrency },
+ { label: 'Received on', value: payment.received_on, type: 'date' },
+ { label: 'Transaction reference', value: payment.transaction_reference }
+ ],
+ modifier: 'stacked',
+ itemModifier: 'stacked'
+ }) }}
+
{% endfor %}
{% endblock %}
diff --git a/test/end-to-end/cypress/receipt-spec.cy.js b/test/end-to-end/cypress/receipt-spec.cy.js
new file mode 100644
index 0000000..cfcbcad
--- /dev/null
+++ b/test/end-to-end/cypress/receipt-spec.cy.js
@@ -0,0 +1,95 @@
+const { paidQuote } = require("../test-data");
+
+describe("Reciept spec", () => {
+ const order = paidQuote;
+
+ context(
+ "When clicking on the 'View your payment receipt' in the order page",
+ () => {
+ it("should take you to the receipt page", () => {
+ cy.visit(`http://localhost:4000/${order.public_token}`);
+ cy.contains("View your payment receipt").click();
+ cy.get('[data-test="heading"]')
+ .should("exist")
+ .and("have.text", "Receipt");
+ });
+ }
+ );
+
+ context("When on the receipt page", () => {
+ beforeEach(() => {
+ cy.visit(`http://localhost:4000/${order.public_token}/receipt`);
+ });
+
+ it("should show the address of the company the receipt is for", () => {
+ cy.contains("To")
+ .should("exist")
+ .parent()
+ .and("contain", order.billing_company_name)
+ .and("contain", order.billing_address_town)
+ .and("contain", order.billing_address_1)
+ .and("contain", order.billing_address_postcode)
+ .and("contain", order.billing_address_country);
+ });
+
+ it("should show the invoice number and a receipt date", () => {
+ cy.contains("Invoice number").should("exist");
+ cy.contains("Receipt date").should("exist");
+ });
+
+ it("should show the invoice adderss and VAT number", () => {
+ cy.contains("From").should("exist");
+ cy.contains("VAT number").should("exist");
+ });
+
+ it("should show a table with the order number, the description and the amount", () => {
+ cy.get('[data-test="cost-table"]')
+ .should("exist")
+ .and("contain", order.reference)
+ .and("contain", `UK Government support in ${order.primaryMarket.name}`)
+ .and("contain", order.subtotal_cost);
+ });
+
+ it("should show the payments heading with the number of payments that were made", () => {
+ cy.get('[data-test="payments-heading"]')
+ .should("exist")
+ .and("contain", "Payment details")
+ .children()
+ .and("contain", `(${order.payments.length} payments)`);
+ });
+
+ it("should show the information for each payment", () => {
+ cy.get('[data-test="payment-1"]')
+ .should("exist")
+ .and("contain", "Payment 1")
+ .and("contain", "Method")
+ .and("contain", order.payments[0].method)
+ .and("contain", "Amount received")
+ .and("contain", order.payments[0].amount)
+ .and("contain", "Received on");
+
+ cy.get('[data-test="payment-2"]')
+ .should("exist")
+ .and("contain", "Payment 2")
+ .and("contain", "Method")
+ .and("contain", order.payments[1].method)
+ .and("contain", "Amount received")
+ .and("contain", order.payments[1].amount)
+ .and("contain", "Received on");
+ });
+
+ it("should take you to the order history page when clicking 'View you order history' link", () => {
+ cy.get('[data-test="view-order-history-link"]')
+ .should("exist")
+ .click()
+ .location("pathname")
+ .should("eq", `/${order.public_token}`);
+
+ cy.contains("Your order").should("exist");
+ });
+
+ it("should have a 'Print this page' link", () => {
+ cy.contains("Print this page").should("exist");
+ });
+ });
+});
diff --git a/test/end-to-end/test-data.js b/test/end-to-end/test-data.js
new file mode 100644
index 0000000..ec40750
--- /dev/null
+++ b/test/end-to-end/test-data.js
@@ -0,0 +1,67 @@
+export const quoteAwaitingAcceptance = {
+ reference: "WHY589/23",
+ created_on: "2024-03-08T13:56:12.108209Z",
+ company: "fc3530bc-383c-4b18-94c8-8fbe918bee31",
+ contact: "9b1138ab-ec7b-497f-b8c3-27fed21694ef",
+ primary_market: "5daf72a6-5d95-e211-a939-e4115bead28a ",
+ sector: "355f977b-8ac3-e211-a646-e4115bead28a",
+ service_types: ["22fc9edd-41a5-4182-ba4e-baacc681d5f7"],
+ description: "test order",
+ public_token: "7AGZC7uaAIV-5L34J5lnZXHvFG9J1xnbBQnieAUCn-LRJpr-QA",
+ delivery_date: "2030-05-07",
+ discount_value: 0,
+ vat_status: "outside_eu",
+ net_cost: 500000,
+ subtotal_cost: 500000,
+ vat_cost: 0,
+ total_cost: 500000,
+ billing_company_name: "Motorleaf",
+ billing_address_1: "5000 Rue Saint-Patrick,",
+ billing_address_town: "Montréal",
+ billing_address_postcode: "H4E 1A8",
+ billing_address_country: "Canada",
+};
+
+export const acceptedQuote = {
+ reference: "RYM547/24",
+ created_on: "2024-03-08T13:56:12.108209Z",
+ company: "fc3530bc-383c-4b18-94c8-8fbe918bee31",
+ contact: "9b1138ab-ec7b-497f-b8c3-27fed21694ef",
+ primary_market: "5daf72a6-5d95-e211-a939-e4115bead28a",
+ sector: "355f977b-8ac3-e211-a646-e4115bead28a",
+ service_types: ["22fc9edd-41a5-4182-ba4e-baacc681d5f7"],
+ description: "test order",
+ public_token: "XXMPH3b2185a7Vpe2f3RiI5HXT0Nshrck_6xGJuRp4UAsA6vkQ",
+ delivery_date: "2030-05-07",
+ discount_value: 0,
+ vat_status: "outside_eu",
+ net_cost: 500000,
+ subtotal_cost: 500000,
+ vat_cost: 0,
+ total_cost: 500000,
+ billing_company_name: "Motorleaf",
+ billing_address_1: "5000 Rue Saint-Patrick,",
+ billing_address_town: "Montréal",
+ billing_address_postcode: "H4E 1A8",
+ billing_address_country: "Canada",
+};
+
+export const paidQuote = {
+ reference: "CJC167/23",
+ status: "draft",
+ description: "test order paid",
+ public_token: "h93Dn7DKvMLbUB5Yz2h5z7dL1mXXGUa_UiPNBkVoyKLmBE29YQ",
+ primaryMarket: { name: "Canada" },
+ delivery_date: "2030-05-07",
+ vat_status: "outside_eu",
+ subtotal_cost: "£1,000.00",
+ billing_company_name: "Motorleaf",
+ billing_address_1: "5000 Rue Saint-Patrick,",
+ billing_address_town: "Montréal",
+ billing_address_postcode: "H4E 1A8",
+ billing_address_country: "Canada",
+ payments: [
+ { method: "Bacs", amount: "£500" },
+ { method: "Manual", amount: "£500" },
+ ],
+};