Documentation for a newer release is available. View Latest

Payment Datasource

Payment Datasource API

The Payment Datasource contract is formally defined through the PaymentDataSource interface. This interface provides methods for retrieving Payment Initiation, Payment Instruction, and Payment Transaction information.

package com.iconsolutions.ipf.core.releaser.loader;

import com.iconsolutions.ipf.core.shared.domain.context.UnitOfWorkId;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Optional;

public interface PaymentDataSource<INIT, INSTR, TRANS> {

    /**
     * Gets a parent Payment Initiation Mono for the provided unitOfWorkId, if any, empty Mono otherwise
     * @param unitOfWorkId unitOfWorkId
     * @return Mono with Payment Instruction of type I, or an empty Mono
     */
    Mono<INIT> getPaymentInitiation(UnitOfWorkId unitOfWorkId);


    /**
     * Gets a Payment Instruction Mono for the provided unitOfWorkId, if any, empty Mono otherwise
     * @param unitOfWorkId unitOfWorkId
     * @return Mono with Payment Instruction of type I, or an empty Mono
     */
    Mono<INSTR> getPaymentInstruction(UnitOfWorkId unitOfWorkId);

    /**
     * Gets a Flux of all payment instructions related to instruction unitOfWorkId provided,
     * with an optional offset as a starting point.
     *
     * @param unitOfWorkId of related payment instruction
     * @param offset optional unitOfWorkId of the last related transaction being already released
     * @return Flux of Payment Transaction objects
     */
    Flux<TRANS> getPaymentTransactions(UnitOfWorkId unitOfWorkId, Optional<UnitOfWorkId> offset);

    /**
     * Gets a Mono of the Payment Transaction for the specific unitOfWorkId provided.
     *
     * @param unitOfWorkId of payment transaction
     * @return Mono of Payment Transaction object
     */
    Mono<TRANS> getPaymentTransaction(UnitOfWorkId unitOfWorkId);

}

Payment Warehouse Datasource

Core Payment Releaser is designed with loose coupling principles and does not depend on any specific datasource implementation. Library users can implement the interface above to provide any datasource and consume the data accordingly.

For convenience, Payment Releaser offers a reference implementation of the datasource. This implementation retrieves Payment information from the Payment Warehouse storage system.