adding citywallet support

This commit is contained in:
Prince
2026-06-11 16:50:41 +02:00
parent 68ed2650e8
commit 0dce7f51dc
6 changed files with 22 additions and 6 deletions

Binary file not shown.

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -1,8 +1,18 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="khoza (generated)" id="1781170534745-3">
<changeSet author="khoza (generated)" id="1781189342457-3">
<addColumn tableName="transaction">
<column name="order_transaction_id" type="varchar(255)"/>
</addColumn>
</changeSet>
<changeSet author="khoza (generated)" id="1781189342457-4">
<addColumn tableName="transaction">
<column name="retries" type="integer"/>
</addColumn>
</changeSet>
<changeSet author="khoza (generated)" id="1781189342457-5">
<addColumn tableName="transaction">
<column name="verification_code" type="varchar(255)"/>
</addColumn>
</changeSet>
</databaseChangeLog>