From cb629b0e3204bc540eb4090105175e778a76bc79 Mon Sep 17 00:00:00 2001 From: Sven laptop Date: Tue, 28 Jul 2026 23:18:19 +0200 Subject: [PATCH] Payment service added --- .gitattributes | 2 +- pom.xml | 10 +++++++++- .../nl/testinstance/store/HomeController.java | 17 ++++++++++++++++ .../nl/testinstance/store/OrdersService.java | 16 +++++++++++++++ .../nl/testinstance/store/PaymentService.java | 5 +++++ .../store/StripePaymentService.java | 20 +++++++++++++++++++ src/main/resources/static/index.html | 10 ++++++++++ 7 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/main/java/nl/testinstance/store/HomeController.java create mode 100644 src/main/java/nl/testinstance/store/OrdersService.java create mode 100644 src/main/java/nl/testinstance/store/PaymentService.java create mode 100644 src/main/java/nl/testinstance/store/StripePaymentService.java create mode 100644 src/main/resources/static/index.html diff --git a/.gitattributes b/.gitattributes index 3b41682..caf59ac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ /mvnw text eol=lf -*.cmd text eol=crlf +*.cmd text eol=crlf \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9378c00..6c65b17 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,16 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-devtools + true + - diff --git a/src/main/java/nl/testinstance/store/HomeController.java b/src/main/java/nl/testinstance/store/HomeController.java new file mode 100644 index 0000000..6726e30 --- /dev/null +++ b/src/main/java/nl/testinstance/store/HomeController.java @@ -0,0 +1,17 @@ +package nl.testinstance.store; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * + * @author sven + */ +@Controller +public class HomeController { + @RequestMapping("/") + public String index() { + return "index.html"; + } + + +} diff --git a/src/main/java/nl/testinstance/store/OrdersService.java b/src/main/java/nl/testinstance/store/OrdersService.java new file mode 100644 index 0000000..f9756e8 --- /dev/null +++ b/src/main/java/nl/testinstance/store/OrdersService.java @@ -0,0 +1,16 @@ +package nl.testinstance.store; + +/** + * + * @author sven + */ +public class OrdersService { + private PaymentService paymentService; + + public OrdersService(PaymentService paymentService) { + this.paymentService = paymentService; + } + public void placeOrder() { + paymentService.processPayment( amount: 10); + } +} diff --git a/src/main/java/nl/testinstance/store/PaymentService.java b/src/main/java/nl/testinstance/store/PaymentService.java new file mode 100644 index 0000000..4d8acdd --- /dev/null +++ b/src/main/java/nl/testinstance/store/PaymentService.java @@ -0,0 +1,5 @@ +package nl.testinstance.store; + +public interface PaymentService { + void processPayment(double amount); +} diff --git a/src/main/java/nl/testinstance/store/StripePaymentService.java b/src/main/java/nl/testinstance/store/StripePaymentService.java new file mode 100644 index 0000000..8b3203a --- /dev/null +++ b/src/main/java/nl/testinstance/store/StripePaymentService.java @@ -0,0 +1,20 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ + +package nl.testinstance.store; + +/** + * + * @author sven + */ +public class StripePaymentService implements PaymentService { + @Override + public void processPayment(double amount) { + System.out.println("STIRPE"); + System.out.println("Amount:" + amount); + + } + +} diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html new file mode 100644 index 0000000..3fad317 --- /dev/null +++ b/src/main/resources/static/index.html @@ -0,0 +1,10 @@ + + + + + Store + + +

Hello world

+ +