adding citywallet support
This commit is contained in:
@@ -16,14 +16,13 @@ import java.util.List;
|
||||
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(
|
||||
public ResponseEntity<Object> getAccountByPhone(
|
||||
@PathVariable String currencyPhoneConcat) {
|
||||
try {
|
||||
VelocityAccountDto account = velocityAccountService.getAccountByPhone(currencyPhoneConcat);
|
||||
Object account = velocityAccountService.getAccountByPhone(currencyPhoneConcat);
|
||||
return ResponseEntity.ok(account);
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().build();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package zw.qantra.tm.domain.dtos.erp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -14,6 +16,8 @@ import java.sql.Timestamp;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class VelocityAccountDto {
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package zw.qantra.tm.domain.dtos.erp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -14,6 +15,8 @@ import java.util.List;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class VelocityStatementDto {
|
||||
private BigDecimal startBalance;
|
||||
private BigDecimal endBalance;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class VelocityAccountService {
|
||||
* @param currencyPhoneConcat The concatenation of currency and phone (e.g. "USD+263771234567").
|
||||
* @return VelocityAccountDto with account details.
|
||||
*/
|
||||
public VelocityAccountDto getAccountByPhone(String currencyPhoneConcat) {
|
||||
public Object getAccountByPhone(String currencyPhoneConcat) {
|
||||
try {
|
||||
LinkedHashMap responseMap = velocityPaymentService.makeRequest(
|
||||
HttpMethod.GET,
|
||||
@@ -37,7 +37,7 @@ public class VelocityAccountService {
|
||||
log.error("Error fetching account");
|
||||
throw new IllegalStateException("Error fetching account");
|
||||
}
|
||||
return Utils.deepCopy(responseMap, VelocityAccountDto.class);
|
||||
return responseMap;
|
||||
} catch (Exception e) {
|
||||
log.error("Error fetching account by phone {}: {}", currencyPhoneConcat, e.getMessage(), e);
|
||||
throw new IllegalStateException("Error fetching account: " + e.getMessage(), e);
|
||||
|
||||
Reference in New Issue
Block a user