Payment Warehouse
Introduction
The IPF Payment Warehouse is an interface designed for storing and querying data related to future-dated payments. It enables the storage of payments created in the present but scheduled for processing at a later time.
The Payment Warehouse operates as a MongoDB collection interface, facilitating the storage of payment details in various forms, including Bulk, Batch, and Transaction.
Core Features
-
Storage: Capable of storing detailed payment information.
-
Querying: Provides methods for retrieving and managing stored payments.
API Overview
The Payment Warehouse API includes the following core methods:
package com.iconsolutions.ipf.core.warehouse.port;
import com.iconsolutions.ipf.core.shared.domain.context.UnitOfWorkId;
import com.iconsolutions.ipf.warehouse.PaymentEntry;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.Optional;
public interface PaymentWarehouse {
Mono<PaymentEntry> save(PaymentEntry paymentEntry);
Flux<PaymentEntry> findAllByUnitOfWorkId(UnitOfWorkId unitOfWorkId);
Mono<Long> countRelatedUnitOfWorkIds(UnitOfWorkId unitOfWorkId);
Flux<UnitOfWorkId> findRelatedUnitOfWorkIds(UnitOfWorkId unitOfWorkId, Pageable pageable);
Flux<List<PaymentEntry>> findAllByUnitOfWorkIds(List<UnitOfWorkId> unitOfWorkIds);
Flux<List<PaymentEntry>> findAllByRelatedUnitOfWorkId(UnitOfWorkId relatedUnitOfWorkId, Optional<UnitOfWorkId> offset);
}
API Methods Description
Below is a detailed description of the primary methods provided by the Payment Warehouse API:
-
save: Persists payment data into the warehouse. Supports storing data for bulk, batch, and transaction processes. -
findAllByUnitOfWorkId: Retrieves all payment entries associated with a specific UnitOfWorkId. Used to fetch the complete set of payment instructions for a given unit of work. -
countRelatedUnitOfWorkIds: Returns the count of unique related unit of work IDs for a specified UnitOfWorkId. Useful for determining the extent of related units of work. -
findRelatedUnitOfWorkIds: Retrieves a paginated list of related UnitOfWorkIds for a given UnitOfWorkId. Helps in navigating through related units of work, particularly in large datasets. -
findAllByUnitOfWorkIds: Fetches payment entries corresponding to a list of UnitOfWorkIds. Retrieves transaction details for multiple units of work in a single call. -
findAllByRelatedUnitOfWorkId: Fetches payment entries which are related to the same UnitOfWorkId. Payment entries with the same UnitOfWorkId are grouped in a List.
Payment Entry Structure
The PaymentEntry class represents the main payment entity:
package com.iconsolutions.ipf.core.warehouse;
import com.iconsolutions.ipf.core.shared.domain.context.ProcessingContext;
import com.iconsolutions.ipf.core.shared.domain.context.UnitOfWorkId;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class PaymentEntry {
private PaymentEntryId id;
private ProcessingContext processingContext;
private UnitOfWorkId relatedUnitOfWorkId;
private String globalState;
private String type;
private List<BusinessDataEntry> data;
}
The BusinessDataEntry represents the client specific business data:
package com.iconsolutions.ipf.core.warehouse;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class BusinessDataEntry {
private String objectId;
private String parentObjectId;
private String name;
private String version;
private Category category;
private Class<?> contentType;
private String content;
public enum Category {
MDS, PDS, DOMAIN_EVENT;
}
}
MongoDB Representation
The corresponding MongoDB representation of PaymentEntry is defined in the MongoPaymentEntry:
package com.iconsolutions.ipf.core.warehouse.port.mongo.repository;
import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Document(collection = "paymententries")
@Data
@Builder
public class MongoPaymentEntry {
@Id
private String id;
private String unitOfWorkId;
private String relatedUnitOfWork;
private String clientRequestId;
private String associationId;
private String processingEntity;
private Integer sequence;
private String globalState;
private String type;
private List<MongoBusinessDataEntry> data;
}
The corresponding MongoDB representation of BusinessDataEntry is defined in the MongoBusinessDataEntry:
package com.iconsolutions.ipf.core.warehouse.port.mongo.repository;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class MongoBusinessDataEntry {
private String objectId;
private String parentObjectId;
private String name;
private String version;
private String category;
private String contentType;
private String content;
}