Payment service added

This commit is contained in:
Sven laptop
2026-07-28 23:18:19 +02:00
parent e64d706ee8
commit cb629b0e32
7 changed files with 78 additions and 2 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
/mvnw text eol=lf /mvnw text eol=lf
*.cmd text eol=crlf *.cmd text eol=crlf
+9 -1
View File
@@ -40,8 +40,16 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@@ -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";
}
}
@@ -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);
}
}
@@ -0,0 +1,5 @@
package nl.testinstance.store;
public interface PaymentService {
void processPayment(double amount);
}
@@ -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);
}
}
+10
View File
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="nl">
<head>
<meta charset="UTF-8" />
<title>Store</title>
</head>
<body>
<h1>Hello world</h1>
</body>
</html>