Java Client SDK for the fire.com Business API


Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

com.fire
Идентификатор

Идентификатор

fire-business-api-java
Последняя версия

Последняя версия

0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Java Client SDK for the fire.com Business API
Java Client SDK for the fire.com Business API
Ссылка на сайт

Ссылка на сайт

https://github.com/firefinancialservices/fire-business-api-java
Система контроля версий

Система контроля версий

https://github.com/firefinancialservices/fire-business-api-java

Скачать fire-business-api-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.fire/fire-business-api-java/ -->
<dependency>
    <groupId>com.fire</groupId>
    <artifactId>fire-business-api-java</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.fire/fire-business-api-java/
implementation 'com.fire:fire-business-api-java:0.1'
// https://jarcasting.com/artifacts/com.fire/fire-business-api-java/
implementation ("com.fire:fire-business-api-java:0.1")
'com.fire:fire-business-api-java:jar:0.1'
<dependency org="com.fire" name="fire-business-api-java" rev="0.1">
  <artifact name="fire-business-api-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.fire', module='fire-business-api-java', version='0.1')
)
libraryDependencies += "com.fire" % "fire-business-api-java" % "0.1"
[com.fire/fire-business-api-java "0.1"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.apache.httpcomponents : httpclient jar 4.4.1
com.google.code.gson : gson jar 2.8.0
commons-codec : commons-codec jar 1.10
org.slf4j : slf4j-api jar 1.7.12

test (1)

Идентификатор библиотеки Тип Версия
ch.qos.logback : logback-classic jar 1.1.3

Модули Проекта

Данный проект не имеет модулей.

fire-business-api-java

A Java SDK for the Fire Business API

Release Artifacts

Include in your Project

Maven

<dependency>
	<groupId>com.fire</groupId>
	<artifactId>fire-business-api-java</artifactId>
	<version>0.1</version>
</dependency>

Gradle

compile group: 'com.fire', name: 'fire-business-api-java', version: '0.1'

Usage

Configure the API client with your API Token credentials.

Credentials credentials = new Credentials()
				.setClientId("<clientId>")
				.setClientKey("<clientKey>")
				.setRefreshToken("<refreshToken>");

FireBusinessAPI api = new FireBusinessAPI().initialise(credentials);

Optionally, you can configure the API to use a different endpoint:

HttpConfiguration config = new HttpConfiguration();
config.setEndpoint("https://api-preprod.fire.com/business/v1");
		
FireBusinessAPI api = new FireBusinessAPI(config).initialise(credentials);

Accounts

List your accounts:

AccountListResponse accountList = api.send(new AccountListRequest());

Long accountId = accountList.getAccounts().get(0).getIcan();
AccountResponse account = api.send(new AccountRequest().setAccountId(accountId));
	
logger.info("Account details: {}, {} / {}", account.getName(), account.getCbic(), account.getCiban());

Transactions

You can list all the transactions for an account:

	
AccountTransactionListResponse transactions = api.send(
	new AccountTransactionListRequest()
			.setAccountId(2150l)
	);
	
logger.info("Transaction 0 details: {}", transactions.getTransactions().get(0).getType());   

Or a single transaction by ID:

TransactionResponse transaction = api.send(new TransactionRequest().setTransactionId(203162l));

Or filter by date range, keyword or transaction type.

AccountTransactionListResponse transactions = null;
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
try {
	transactions = api.send(new AccountTransactionListRequest()
			.setAccountId(2150l)
			.setDateRangeFrom(df.parse("2017-05-01"))
			.setDateRangeTo(df.parse("2017-06-01"))
			);
} catch (ParseException e) {
	e.printStackTrace();
}
logger.info("Transaction 0 details: {}", transactions.getTransactions().get(0).getType());

Batches of Payments

List of your batches:

// All batches:
BatchListResponse batches = api.send(new BatchListRequest());

// Just the pending batches:
BatchListResponse batches = api.send(	new BatchListRequest()
		.setBatchStatuses(new BatchStatus[] { BatchStatus.PENDING_APPROVAL, BatchStatus.PENDING_PARENT_BATCH_APPROVAL })
	);

logger.info("Batch 0 = {}", batches.getBatches().get(0).getBatchName());

Create a new batch, add an internal transfer and submit the batch:

// Create the Batch Object
Batch internalTransferBatch = new Batch()
	.setType(Batch.BatchType.INTERNAL_TRANSFER)
	.setCurrency("EUR")
	.setBatchName("Java SDK test")
	.setJobNumber("2019-01-09")
	.setCallbackUrl("https://www.example.com/batch/callback");
    
// Open this batch in fire.com
BatchNewRequest newBatchRequest = new BatchNewRequest().setBatch(internalTransferBatch);
BatchNewResponse newBatch = api.send(newBatchRequest);

logger.info("New batch ID = {}", newBatch.getBatchUuid());

// Get the batchUUID
String batchUuid = newBatch.getBatchUuid();
		              
// Create the internal transfer objects  
InternalTransfer internalTransfer = new InternalTransfer()
	.setAmount(500L)
	.setIcanFrom(5532L)
	.setIcanTo(2150L)
	.setRef("Testing Java SDK");
		
// Add them to the batch
BatchAddItemResponse newItem = api.send(new BatchAddItemRequest()
		.setBatchUuid(batchUuid)
		.setBatchItem(internalTransfer)
	);

// List the items in the batch if required
BatchListItemsResponse items = api.send(new BatchListItemsRequest()
		.setBatchUuid(batchUuid)
		.setBatchType(Batch.BatchType.INTERNAL_TRANSFER)
	);
logger.info("Batch Items: {}", items.getBatchItems());

// Submit the batch for processing. Internal Transfer are processed immediately.         
api.send(new BatchSubmitRequest().setBatchUuid(batchUuid));

Create a new batch, add external transfers of various types and submit the batch:

// Create the Batch Object
Batch internalTransferBatch = new Batch()
	.setType(Batch.BatchType.BANK_TRANSFER)
	.setCurrency("EUR")
	.setBatchName("Java SDK test")
	.setJobNumber("2019-01-09")
	.setCallbackUrl("https://www.example.com/batch/callback");
    
// Open this batch in fire.com
BatchNewRequest newBatchRequest = new BatchNewRequest().setBatch(internalTransferBatch);
BatchNewResponse newBatch = api.send(newBatchRequest);

logger.info("New batch ID = {}", newBatch.getBatchUuid());

// Get the batchUUID
String batchUuid = newBatch.getBatchUuid();
		              
// Create the bank transfer objects (Using account details)
BankTransfer bankTransfer = new BankTransfer()
	.setAmount(1000L)
	.setPayeeType(PayeeType.ACCOUNT_DETAILS)
	.setDestAccountHolderName("John Q. Doe")
	// GBP Account number and sort code
	.setDestAccountNumber("12345678")
	.setDestNsc("999999")
	// EUR IBAN
	.setDestIban("IE99BANK99999999999999")
	.setIcanFrom(2150L)
	.setMyRef("testing API")
	.setYourRef("From API");

// Create the bank transfer objects (Using saved payee details)
BankTransfer bankTransfer = new BankTransfer()
	.setAmount(1000L)
	.setPayeeType(PayeeType.PAYEE_ID)
	.setPayeeId(1231234L)
	.setIcanFrom(2150L)
	.setMyRef("testing API")
	.setYourRef("From API");
			
// Add them to the batch
BatchAddItemResponse newItem = api.send(new BatchAddItemRequest()
		.setBatchUuid(batchUuid)
		.setBatchItem(bankTransfer)
	);

// List the items in the batch if required
BatchListItemsResponse items = api.send(new BatchListItemsRequest()
		.setBatchUuid(batchUuid)
		.setBatchType(Batch.BatchType.BANK_TRANSFER)
	);
logger.info("Batch Items: {}", items.getBatchItems());

// Submit the batch for processing. Bank Transfers require approval before they are processed.         
api.send(new BatchSubmitRequest().setBatchUuid(batchUuid));

Developing

To create a new release to the maven repository, ensure that the pom version is updated and not a SNAPSHOP, and use mvn deploy.

Deploying to OSSRH with Apache Maven

com.fire

Fire Financial Services

Версии библиотеки

Версия
0.1