adding citywallet support

This commit is contained in:
Prince
2026-06-11 16:34:01 +02:00
parent fadb1e3f8d
commit 68ed2650e8
18 changed files with 477 additions and 131 deletions

View File

@@ -0,0 +1,47 @@
package zw.qantra.tm.domain.controllers;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import zw.qantra.tm.domain.dtos.erp.VelocityAccountDto;
import zw.qantra.tm.domain.dtos.erp.VelocityStatementDto;
import zw.qantra.tm.domain.services.VelocityAccountService;
import java.util.List;
@RestController
@RequestMapping("/accounts")
@RequiredArgsConstructor
public class AccountController {
private final VelocityAccountService velocityAccountService;
private static final List<String> SUPPORTED_CURRENCIES = List.of("USD", "ZWG");
@GetMapping("/phone/{currencyPhoneConcat}")
@PreAuthorize("hasRole('ACCOUNT_READ')")
public ResponseEntity<VelocityAccountDto> getAccountByPhone(
@PathVariable String currencyPhoneConcat) {
try {
VelocityAccountDto account = velocityAccountService.getAccountByPhone(currencyPhoneConcat);
return ResponseEntity.ok(account);
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
@GetMapping("/phone/{currencyPhoneConcat}/statement")
@PreAuthorize("hasRole('ACCOUNT_READ')")
public ResponseEntity<VelocityStatementDto> getStatementByPhone(
@PathVariable String currencyPhoneConcat,
@RequestParam String startDate,
@RequestParam String endDate) {
try {
VelocityStatementDto statement = velocityAccountService.getStatementByPhone(
currencyPhoneConcat, startDate, endDate);
return ResponseEntity.ok(statement);
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
}