adding citywallet support
This commit is contained in:
Binary file not shown.
@@ -16,14 +16,13 @@ import java.util.List;
|
|||||||
public class AccountController {
|
public class AccountController {
|
||||||
|
|
||||||
private final VelocityAccountService velocityAccountService;
|
private final VelocityAccountService velocityAccountService;
|
||||||
private static final List<String> SUPPORTED_CURRENCIES = List.of("USD", "ZWG");
|
|
||||||
|
|
||||||
@GetMapping("/phone/{currencyPhoneConcat}")
|
@GetMapping("/phone/{currencyPhoneConcat}")
|
||||||
@PreAuthorize("hasRole('ACCOUNT_READ')")
|
@PreAuthorize("hasRole('ACCOUNT_READ')")
|
||||||
public ResponseEntity<VelocityAccountDto> getAccountByPhone(
|
public ResponseEntity<Object> getAccountByPhone(
|
||||||
@PathVariable String currencyPhoneConcat) {
|
@PathVariable String currencyPhoneConcat) {
|
||||||
try {
|
try {
|
||||||
VelocityAccountDto account = velocityAccountService.getAccountByPhone(currencyPhoneConcat);
|
Object account = velocityAccountService.getAccountByPhone(currencyPhoneConcat);
|
||||||
return ResponseEntity.ok(account);
|
return ResponseEntity.ok(account);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.badRequest().build();
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package zw.qantra.tm.domain.dtos.erp;
|
package zw.qantra.tm.domain.dtos.erp;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -14,6 +16,8 @@ import java.sql.Timestamp;
|
|||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class VelocityAccountDto {
|
public class VelocityAccountDto {
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package zw.qantra.tm.domain.dtos.erp;
|
package zw.qantra.tm.domain.dtos.erp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -14,6 +15,8 @@ import java.util.List;
|
|||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class VelocityStatementDto {
|
public class VelocityStatementDto {
|
||||||
private BigDecimal startBalance;
|
private BigDecimal startBalance;
|
||||||
private BigDecimal endBalance;
|
private BigDecimal endBalance;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class VelocityAccountService {
|
|||||||
* @param currencyPhoneConcat The concatenation of currency and phone (e.g. "USD+263771234567").
|
* @param currencyPhoneConcat The concatenation of currency and phone (e.g. "USD+263771234567").
|
||||||
* @return VelocityAccountDto with account details.
|
* @return VelocityAccountDto with account details.
|
||||||
*/
|
*/
|
||||||
public VelocityAccountDto getAccountByPhone(String currencyPhoneConcat) {
|
public Object getAccountByPhone(String currencyPhoneConcat) {
|
||||||
try {
|
try {
|
||||||
LinkedHashMap responseMap = velocityPaymentService.makeRequest(
|
LinkedHashMap responseMap = velocityPaymentService.makeRequest(
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
@@ -37,7 +37,7 @@ public class VelocityAccountService {
|
|||||||
log.error("Error fetching account");
|
log.error("Error fetching account");
|
||||||
throw new IllegalStateException("Error fetching account");
|
throw new IllegalStateException("Error fetching account");
|
||||||
}
|
}
|
||||||
return Utils.deepCopy(responseMap, VelocityAccountDto.class);
|
return responseMap;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error fetching account by phone {}: {}", currencyPhoneConcat, e.getMessage(), e);
|
log.error("Error fetching account by phone {}: {}", currencyPhoneConcat, e.getMessage(), e);
|
||||||
throw new IllegalStateException("Error fetching account: " + e.getMessage(), e);
|
throw new IllegalStateException("Error fetching account: " + e.getMessage(), e);
|
||||||
|
|||||||
@@ -1,8 +1,18 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
<?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">
|
<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">
|
<addColumn tableName="transaction">
|
||||||
<column name="retries" type="integer"/>
|
<column name="retries" type="integer"/>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
<changeSet author="khoza (generated)" id="1781189342457-5">
|
||||||
|
<addColumn tableName="transaction">
|
||||||
|
<column name="verification_code" type="varchar(255)"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
Reference in New Issue
Block a user