MCPcopy Create free account
hub / github.com/Anchals24/Low-Level-Design / PaymentFlow

Class PaymentFlow

TemplateDesignPattern/PaymentFlow.java:3–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1package BehaviouralDesignPatterns.TemplateDesignPattern;
2
3public abstract class PaymentFlow {
4
5 public abstract void validateRequest();
6 public abstract void debitMoney();
7 public abstract void calculateCharges();
8 public abstract void creditMoney();
9
10 public final void sendMoney(){
11 //Template Method: Defines the order of steps to execute the task.
12 //Step-1:
13 System.out.println("Step-1:");
14 validateRequest();
15 //Step-2:
16 System.out.println("Step-2:");
17 debitMoney();
18 //Step-3:
19 System.out.println("Step-3:");
20 calculateCharges();
21 //Step-4:
22 System.out.println("Step-4:");
23 creditMoney();
24
25 }
26}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected