Update exchange cbs rpc java authored by Patryk's avatar Patryk
Java class representing JSON-RPC API for CBS. Used by ExchangeClient.
[Docs with examples.]()
```java
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
/**
* JSON-RPC API for communication between ExchangeClient and CBS.
*/
public interface IExchangeApi {
BankStatusRes getBankStatus();
AccountRes getBankAccount();
TransactionRes createTransaction(NewTransactionReq transactionData);
List<TransactionRes> getTransactions(
BankRelation type,
List<BigInteger> ids,
BigInteger afterId,
List<String> status,
String createdAfter,
String createdBefore,
String updatedAfter,
String updatedBefore,
String title,
List<String> orderBy,
Integer limit,
Integer offset
);
List<TransactionStatusRes> getTransactionsStatus(
BankRelation type,
List<BigInteger> ids,
BigInteger afterId,
List<String> status,
String createdAfter,
String createdBefore,
String updatedAfter,
String updatedBefore,
String title,
List<String> orderBy,
Integer limit,
Integer offset
);
}
/*
RESPONSES
*/
class BankStatusRes {
String bankName; // Name of the bank
Status status; // See BankStatus for possible statuses
String updatedAt; // Timestamp for last status change (ISO 8601)
}
class AccountRes {
BigInteger accountNumber; // Internal account number
String iban; // Bank Account IBAN
String bic; // Bank's BIC code
String currency; // 3-letter currency code (ISO 4217)
BigDecimal balance; // Current available balance of the account
String owner; // Full (legal) name of the account's owner
Address address; // Basic address information
}
class TransactionRes {
BigInteger transactionId; // Internal transaction id
BankRelation type; // Transaction can be either 'INTERNAL' or 'EXTERNAL'
Status status; // Current transaction status
String receivedAt; // Timestamp for when transaction was received by CBS (ISO 8601)
String updatedAt; // Timestamp for last status change (ISO 8601)
String title;
BigDecimal amount;
String currency; // 3-letter currency code (ISO 4217)
TransactionParty debtor; // Party which sends the money
TransactionParty creditor; // Party which receives the money
}
class TransactionStatusRes {
BigInteger transactionId; // Internal transaction id
String updatedAt; // Timestamp for last status change (ISO 8601)
Status status; // Current transaction status
}
class NewTransactionReq {
String title;
BigDecimal amount;
String currency; // 3-letter currency code (ISO 4217)
TransactionParty debtor; // Party which sends the money
TransactionParty creditor; // Party which receives the money
}
/*
PARTS
*/
class TransactionParty {
String iban;
String bic;
String name;
Address address;
}
class Address {
String country;
String addressLine1;
String addressLine2;
}
class Status {
String code; // 4-letter status code
String name;
String description;
Reason reason; // (optional) Not every status has reason
}
class Reason {
String code;
String name;
String description;
}
enum BankStatus {
ACTIVE("ACTV", "System is up and the bank is currently accepting new requests"),
SUSPENDED("SUSP", "System is healthy but the bank is currently suspended (e.g. outside of working hours)"),
UNAVAILABLE("UNVL", "System is down or cannot process incoming requests (e.g. internal errors)");
private String description;
private String code;
private BankStatus(String code, String description) {
this.description = description;
this.code = code;
}
public String getDescription() {
return description;
}
public String getCode() {
return code;
}
}
enum BankRelation {
INTERNAL,
EXTERNAL;
}
```
\ No newline at end of file