Skip to content

Commit

Permalink
feat: ADORSYS-GIS#3 implement model classes following MVC pattern for…
Browse files Browse the repository at this point in the history
… Spring Boot backend (ADORSYS-GIS#73)

* implement model classes following MVC pattern for Spring Boot backend

* Refactor model classes and annotations based on requirements
  • Loading branch information
NkwaTambe authored Mar 7, 2024
1 parent f431fb7 commit e466a68
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;


import jakarta.persistence.Entity;

@Entity
public class CheckBalance extends Procedure {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

@Entity
public abstract class Procedure {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
public ProcedureStatus status = ProcedureStatus.WAITING;
private String phoneNumber;


public void markAsDone() {
status = ProcedureStatus.DONE;
}

public void markAsError() {
status = ProcedureStatus.ERROR;
}

public boolean isDone() {
return status == ProcedureStatus.DONE;
}

public boolean isError() {
return status == ProcedureStatus.ERROR;
}

public boolean isWaiting() {
return status == ProcedureStatus.WAITING;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public ProcedureStatus getStatus() {
return status;
}

public void setStatus(ProcedureStatus status) {
this.status = status;
}

public String getPhoneNumber() {
return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;

public enum ProcedureStatus {

DONE,
WAITING,
ERROR
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;

public enum ProcedureType {
Transaction,
CheckBalance
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;

import jakarta.persistence.Entity;

@Entity
public class Transaction extends Procedure {
private String receiverPhoneNumber;
private Double amount;
private String currency;

{
currency = "XAF";
}

public String getReceiverPhoneNumber() {
return receiverPhoneNumber;
}

public void setReceiverPhoneNumber(String receiverPhoneNumber) {
this.receiverPhoneNumber = receiverPhoneNumber;
}

public Double getAmount() {
return amount;
}

public void setAmount(Double amount) {
this.amount = amount;
}

public String getCurrency() {
return currency;
}

public void setCurrency(String currency) {
this.currency = currency;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private String phoneNumber;
private String pin;
private String userName;

public String getPhoneNumber() {
return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}

public String getPin() {
return pin;
}

public void setPin(String pin) {
this.pin = pin;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.adorsys.gis.powerpay.powerpaybackend.domain;

import jakarta.persistence.Entity;

@Entity
public class UserRegistration extends Procedure{
private String opt;
private String userName;

public String getOpt() {
return opt;
}

public void setOpt(String opt) {
this.opt = opt;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}
}

0 comments on commit e466a68

Please sign in to comment.