Skip to content
Permalink
Browse files
first iteration for teller management
  • Loading branch information
mgeiss committed Jun 11, 2017
1 parent d66dbe2 commit 55ce69bf7b01e39635b1d4718f87220a2f9fd664
Show file tree
Hide file tree
Showing 53 changed files with 2,825 additions and 155 deletions.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller;
package io.mifos.teller.api.v1;

@SuppressWarnings("unused")
public interface EventConstants {
@@ -27,4 +27,10 @@ public interface EventConstants {

String POST_TELLER = "post-teller";
String SELECTOR_POST_TELLER = SELECTOR_NAME + " = '" + POST_TELLER + "'";
String PUT_TELLER = "put-teller";
String SELECTOR_PUT_TELLER = SELECTOR_NAME + " = '" + PUT_TELLER + "'";
String OPEN_TELLER = "open-teller";
String SELECTOR_OPEN_TELLER = SELECTOR_NAME + " = '" + OPEN_TELLER + "'";
String CLOSE_TELLER = "close-teller";
String SELECTOR_CLOSE_TELLER = SELECTOR_NAME + " = '" + CLOSE_TELLER + "'";
}
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller;
package io.mifos.teller.api.v1;

@SuppressWarnings("unused")
public interface PermittableGroupIds {
@@ -0,0 +1,19 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.client;

public class TellerAlreadyExistsException extends RuntimeException {
}
@@ -1,14 +1,29 @@
package io.mifos.teller.client;
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.client;

import io.mifos.core.api.annotation.ThrowsException;
import io.mifos.core.api.annotation.ThrowsExceptions;
import io.mifos.core.api.util.CustomFeignClientsConfiguration;
import io.mifos.teller.domain.Teller;
import io.mifos.teller.domain.TellerAuthentication;
import io.mifos.teller.domain.TellerBalanceSheet;
import io.mifos.teller.domain.TellerManagementCommand;
import io.mifos.teller.domain.TellerTransaction;
import io.mifos.teller.domain.TellerTransactionCosts;
import io.mifos.teller.api.v1.domain.Teller;
import io.mifos.teller.api.v1.domain.TellerAuthentication;
import io.mifos.teller.api.v1.domain.TellerBalanceSheet;
import io.mifos.teller.api.v1.domain.TellerManagementCommand;
import io.mifos.teller.api.v1.domain.TellerTransaction;
import io.mifos.teller.api.v1.domain.TellerTransactionCosts;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@@ -25,7 +40,7 @@
public interface TellerManager {

@RequestMapping(
value = "/offices/{officeIdentifier}",
value = "/offices/{officeIdentifier}/teller",
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
@@ -44,7 +59,8 @@ public interface TellerManager {
produces = MediaType.ALL_VALUE
)
@ThrowsExceptions({
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = TellerNotFoundException.class)
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = TellerNotFoundException.class),
@ThrowsException(status = HttpStatus.BAD_REQUEST, exception = TellerValidationException.class)
})
Teller find(@PathVariable("officeIdentifier") final String officeIdentifier,
@PathVariable("tellerCode") final String tellerCode);
@@ -56,7 +72,8 @@ Teller find(@PathVariable("officeIdentifier") final String officeIdentifier,
produces = MediaType.ALL_VALUE
)
@ThrowsExceptions({
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = TellerNotFoundException.class)
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = TellerNotFoundException.class),
@ThrowsException(status = HttpStatus.BAD_REQUEST, exception = TellerValidationException.class)
})
List<Teller> fetch(@PathVariable("officeIdentifier") final String officeIdentifier);

@@ -0,0 +1,19 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.client;

public class TellerNotFoundException extends RuntimeException {
}
@@ -0,0 +1,19 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.client;

public class TellerTransactionValidationException extends RuntimeException {
}
@@ -0,0 +1,19 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.client;

public class TellerValidationException extends RuntimeException {
}
@@ -0,0 +1,51 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.domain;

public class Charge {

private String code;
private String name;
private Double amount;

public Charge() {
super();
}

public String getCode() {
return this.code;
}

public void setCode(final String code) {
this.code = code;
}

public String getName() {
return this.name;
}

public void setName(final String name) {
this.name = name;
}

public Double getAmount() {
return this.amount;
}

public void setAmount(final Double amount) {
this.amount = amount;
}
}
@@ -1,4 +1,19 @@
package io.mifos.teller.domain;
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.domain;

import io.mifos.core.lang.validation.constraints.ValidIdentifier;
import org.hibernate.validator.constraints.NotEmpty;
@@ -8,7 +23,7 @@

public class Teller {

public enum Status {
public enum State {
ACTIVE,
CLOSED,
OPEN,
@@ -26,7 +41,8 @@ public enum Status {
private String tellerAccountIdentifier;
@ValidIdentifier
private String vaultAccountIdentifier;
private Status status;
private String assignedEmployee;
private State state;
private String createdBy;
private String createdOn;
private String lastModifiedBy;
@@ -76,12 +92,24 @@ public void setVaultAccountIdentifier(final String vaultAccountIdentifier) {
this.vaultAccountIdentifier = vaultAccountIdentifier;
}

public String getStatus() {
return this.status.name();
public String getAssignedEmployee() {
return this.assignedEmployee;
}

public void setStatus(final String status) {
this.status = Status.valueOf(status);
public void setAssignedEmployee(final String assignedEmployee) {
this.assignedEmployee = assignedEmployee;
}

public String getState() {
if (this.state != null) {
return this.state.name();
} else {
return null;
}
}

public void setState(final String state) {
this.state = State.valueOf(state);
}

public String getCreatedBy() {
@@ -0,0 +1,42 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.domain;

public class TellerAuthentication {

private String employeeIdentifier;
private byte[] password;

public TellerAuthentication() {
super();
}

public String getEmployeeIdentifier() {
return this.employeeIdentifier;
}

public void setEmployeeIdentifier(final String employeeIdentifier) {
this.employeeIdentifier = employeeIdentifier;
}

public byte[] getPassword() {
return this.password;
}

public void setPassword(final byte[] password) {
this.password = password;
}
}
@@ -0,0 +1,53 @@
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.teller.api.v1.domain;

import java.util.List;

public class TellerBalanceSheet {

private String day;
private Double balance;
private List<TellerEntry> entries;

public TellerBalanceSheet() {
super();
}

public String getDay() {
return this.day;
}

public void setDay(final String day) {
this.day = day;
}

public Double getBalance() {
return this.balance;
}

public void setBalance(final Double balance) {
this.balance = balance;
}

public List<TellerEntry> getEntries() {
return this.entries;
}

public void setEntries(final List<TellerEntry> entries) {
this.entries = entries;
}
}

0 comments on commit 55ce69b

Please sign in to comment.