Quick Start:

  • Access the application at application options
  • with Swagger UI (API Docs) available at /swagger-ui.html
  • /v3/api-docs
  • /v3/api-docs.yaml
  • What is Axigrate?

    Axigrate is a Spring Boot microservice that serves as a comprehensive business integration platform, connecting various external systems with a core AS400/IBM i system running Bookmaster ERP. The application handles sales order processing, purchasing workflows, accounting transactions, and courier integrations for the book publishing and distribution industry.

    Key Features

    EDI Processing

    X12 4010 850 and EDIFACT ORDERS v6.0 support with Smooks framework

    AS400 Integration

    Direct connection to Bookmaster ERP via JTOpen (jt400) driver

    File Transfer

    Embedded FTP/SFTP servers with automated file processing

    Api

    Support for transactions via RESTful Api's, eg. Sales Orders

    Supply Chain Process Flow

    Item Catalog
    Customer Orders
    Order Acknowledgements
    Purchase Orders
    Supplier Acknowledgements
    Courier Requests
    Backstamps
    Claims

    Service Layer Structure

    Service Package Purpose Key Components
    /service/ Core Services AS400Service, SalesService, PurchasingService, AccountingService, CourierService
    /service/comms/ Communication EmailService, FTPService, SftpJSchService
    /service/digest/ Data Processing EDI parsing and data transformation
    /service/distr/ Distribution Order processing, inventory management
    /service/accg/ Accounting Financial transactions, AR/GL processing

    Technology Stack

    Framework

    Spring Boot 3.3.3, Java 17+

    Database

    IBM i DB2, PostgreSQL, MySQL, SQL Server

    Integration

    Apache Camel 4.6.0, Spring Integration

    EDI Processing

    Smooks 2.2.1, EDI Reader 4.7.3

    Security

    JWT, Spring Security, API Keys

    UI Framework

    JSF with JoinFaces, PrimeFaces

    Catalog Data Sources

    The item catalog is primarily maintained in the Bookmaster ERP system on AS400/IBM i and synchronized with external systems.

    Key Database Tables:

    • Item Master: Core product information (ISBN, title, author, publisher)
    • Item Classification: Product categorization and groupings
    • Item Templates: Default settings for new products
    • Warehouse Item Balance: Stock levels across warehouses
    • Special Price Files: Customer-specific pricing

    Catalog Services

    GET /api/catalog/items Retrieve item catalog
    GET /api/catalog/items/{isbn} Get specific item details
    GET /api/catalog/pricing/{customer} Customer-specific pricing
    GET /api/catalog/inventory/{warehouse} Warehouse inventory levels

    Data Synchronization

    Catalog data is synchronized with external systems through various mechanisms:

    Scheduled Updates

    Automated catalog feeds to major customers (Amazon, Van Schaik)

    Real-time API

    REST endpoints for immediate catalog lookups

    File Exports

    CSV/XML exports via FTP/SFTP for batch processing

    EDI Integration

    Product catalog data embedded in EDI transactions

    Service Implementation: Catalog services are implemented in ItemClassificationService, ItemTemplateService, and WarehouseItemBalanceService classes.

    Order Input Channels

    EDI Orders

    X12 4010 850 and EDIFACT ORDERS v6.0 via FTP/SFTP

    Web API

    REST API for real-time order submission

    File Uploads

    CSV/Excel file uploads via embedded FTP server

    Manual Entry

    Web interface for direct order entry

    Order Processing Workflow

    Order Receipt
    Validation
    Customer Lookup
    Item Validation
    Pricing
    AS400 Creation

    Processing Steps:

    1. Order Receipt: Orders received via various channels are queued for processing
    2. Format Validation: EDI parsing and data structure validation
    3. Customer Validation: Customer account verification and credit checks
    4. Item Validation: ISBN/product code verification and availability
    5. Pricing Calculation: Apply customer-specific pricing and discounts
    6. AS400 Integration: Create order in Bookmaster ERP system

    EDI Order Processing

    Specialized handling for EDI order formats:

    Format Configuration Processing Service Status
    X12 4010 850 smooks-config-ediX12-850-order.xml SalesDigestX12Service Active
    EDIFACT ORDERS v6.0 smooks-config-edifact-orders-v6.0.xml SalesDigestEdifactService Active
    EDIFACT Custom smooks-config-edifact-orders-v6.0-custom.xml SalesDigestEdifactCustomService Development

    Order Interface Tables

    Orders are staged in interface tables before AS400 processing:

    • OrderInterfaceDetailRepository: Order line items
    • OrderInterfaceHeaderSupplementRepository: Order header information
    • OrderInterfaceDetailSupplementRepository: Additional line details
    • OrderInterfaceBillingRepository: Billing information
    • OrderInterfaceTextRepository: Order notes and comments
    Scheduled Processing: Orders are processed every 15 minutes during business hours (5am-9pm) via Spring's @Scheduled annotations.

    Acknowledgement Types

    EDI Acknowledgements

    EDI 855 Purchase Order Acknowledgement

    Email Confirmations

    HTML/Text email templates for order confirmation

    File Exports

    CSV/XML acknowledgement files via FTP

    API Responses

    Real-time acknowledgements for API orders

    Acknowledgement Processing Flow

    Order Created
    Generate ACK
    Format Selection
    Template Processing
    Delivery

    Processing Logic:

    1. Trigger: Acknowledgement triggered when order is successfully created in AS400
    2. Data Gathering: Collect order details, customer information, and delivery estimates
    3. Format Selection: Determine acknowledgement format based on customer preferences
    4. Template Processing: Apply appropriate templates for formatting
    5. Delivery: Send via configured delivery method (EDI, email, FTP)

    Acknowledgement Templates

    Email acknowledgements use Freemarker templates located in src/main/resources/templates/:

    Template Purpose Format
    order-confirmation.html.ftl HTML email confirmation Rich HTML with styling
    order-confirmation.txt.ftl Plain text confirmation Simple text format

    Customer-Specific Configurations

    Customer

    EDI 855 + Email confirmations

    Amazon

    EDI 855 acknowledgements via AS2

    Van Schaik

    Custom XML format via SFTP

    Customer

    CSV acknowledgements via FTP

    Email Service: Acknowledgements are sent using Spring's JavaMailSender with configurable SMTP settings for each customer profile.

    Purchase Order Triggers

    Stock Replenishment

    Automatic POs when inventory falls below reorder points

    Customer Orders

    Direct supplier orders for items not in stock

    Manual Creation

    User-initiated purchase orders via web interface

    Scheduled Ordering

    Regular orders based on forecasting and demand

    Purchase Order Processing Flow

    PO Generation
    Supplier Lookup
    Format Selection
    Approval
    Transmission
    Tracking

    Key Processing Steps:

    1. PO Generation: System generates purchase orders based on triggers
    2. Supplier Lookup: Identify primary and alternate suppliers
    3. Format Selection: Choose appropriate format (EDI, email, fax)
    4. Approval Workflow: Route for approval if required
    5. Transmission: Send to supplier via configured method
    6. Tracking: Monitor for acknowledgements and updates

    Purchase Order Database Tables

    Table/Repository Purpose Key Fields
    PurchaseOrderDetailRepository PO line items Item, Quantity, Price, Delivery Date
    PurchasingItemSupplierRepository Item-supplier relationships Supplier preferences, lead times
    PurchaseOrderToOrderLinkRepository Links POs to customer orders Traceability and allocation
    PurchaseLandingChargeDetailRepository Shipping and handling costs Freight, duties, insurance

    Supplier Communication Methods

    EDI 850

    Electronic Data Interchange for large suppliers

    Email

    PDF attachments or formatted HTML emails

    FTP/SFTP

    File-based PO transmission

    Web Services

    API integration with supplier systems

    Automated Processing: Purchase orders are processed every 30 minutes during business hours (6am-6pm) with configurable scheduling via purchasing.outbound.scheduled property.

    Acknowledgement Types

    EDI 855

    Purchase Order Acknowledgement via EDI

    Email Responses

    Email confirmations with structured data

    File Uploads

    CSV/Excel files via FTP/SFTP

    API Updates

    Real-time acknowledgements via web services

    Acknowledgement Processing Flow

    ACK Receipt
    Format Parsing
    PO Matching
    Status Update
    Exception Handling
    Notification

    Processing Logic:

    1. Receipt: Acknowledgement received via configured channel
    2. Parsing: Extract structured data from various formats
    3. Matching: Match acknowledgement to original purchase order
    4. Status Update: Update PO status and delivery dates
    5. Exception Handling: Process rejections, changes, and partial accepts
    6. Notification: Alert purchasing team of status changes

    Acknowledgement Status Types

    Status Description Action Required Notification
    Accepted PO accepted as submitted None Confirmation email
    Changed PO accepted with modifications Review changes Alert to purchasing
    Partial Only some items accepted Handle rejected items Exception report
    Rejected PO rejected entirely Find alternate supplier Urgent alert

    Shipment Receipt Processing

    The system also processes advance ship notices (ASN) and goods receipt confirmations:

    • ShipmentReceiptRepository: Tracks incoming shipments
    • Automated Matching: Links receipts to purchase orders
    • Inventory Updates: Updates stock levels upon receipt
    • Quality Control: Manages inspection and acceptance processes
    Integration Point: Supplier acknowledgements update the AS400 system in real-time, ensuring accurate order status across all systems.

    Courier Integration Partners

    Dawn Wing

    Primary courier for JBP shipments

    Fastway

    Alternative courier service

    PostNet

    Local and regional deliveries

    Custom Carriers

    Customer-specific courier preferences

    Collection Request Flow

    Order Ready
    Carrier Selection
    Booking Request
    Collection Scheduling
    Label Generation
    Dispatch

    Automated Workflow:

    1. Order Ready: System detects orders ready for shipment
    2. Carrier Selection: Choose carrier based on customer, destination, and service level
    3. Booking Request: Submit collection request to courier API
    4. Scheduling: Receive collection slot and tracking information
    5. Label Generation: Generate shipping labels and documentation
    6. Dispatch: Update order status and notify customer

    Courier Service Management

    The CourierService manages all courier-related operations:

    Function Description Repository
    Carrier Management Maintain courier company details CarrierRepository
    Collection Booking Submit collection requests CourierService API
    Label Printing Generate shipping labels Integrated label service
    Tracking Updates Monitor shipment progress Webhook/polling service

    Collection Request Configuration

    Service Levels

    Standard, Express, Overnight delivery options

    Address Validation

    Automated address verification and correction

    Rate Calculation

    Real-time shipping cost calculation

    Insurance Options

    Automatic insurance based on order value

    Error Handling: Failed collection requests are automatically retried with alternative carriers and escalated to operations team if unresolved.

    Backstamp Data Sources

    Courier APIs

    Real-time delivery status via webhook

    File Uploads

    Daily backstamp files via FTP/SFTP

    Email Updates

    Delivery notifications parsed from emails

    Manual Entry

    Operations team manual status updates

    Backstamp Processing Flow

    Status Received
    Tracking Match
    Order Update
    Customer Notification
    Invoice Trigger
    Analytics Update

    Processing Workflow:

    1. Status Receipt: Delivery status received from various sources
    2. Tracking Match: Match tracking number to original order
    3. Order Update: Update order status in AS400 system
    4. Customer Notification: Send delivery confirmation to customer
    5. Invoice Trigger: Trigger invoicing process if applicable
    6. Analytics: Update delivery performance metrics

    Delivery Status Types

    Status Description Customer Notification Next Action
    Delivered Package successfully delivered Delivery confirmation email Trigger invoice
    Failed Delivery Delivery attempt unsuccessful Delivery attempt notification Schedule redelivery
    In Transit Package in courier network Tracking update (optional) Continue monitoring
    Exception Delivery exception occurred Exception alert Manual intervention

    Proof of Delivery (POD)

    The system captures and stores proof of delivery information:

    • Digital Signatures: Electronic signature capture
    • Photo Evidence: Delivery photos from courier
    • GPS Coordinates: Delivery location verification
    • Recipient Details: Name and time of person who received
    • Delivery Notes: Special instructions or exceptions

    Integration with Business Processes

    Invoicing

    Automatic invoice generation upon delivery

    Customer Service

    Real-time delivery status for inquiries

    Returns Processing

    Failed delivery handling and returns

    Performance Analytics

    Delivery performance metrics and KPIs

    Real-time Updates: Backstamp processing provides real-time visibility into delivery status across all courier partners and delivery channels.

    Types of Claims

    Damage Claims

    Items damaged in transit or storage

    Return Claims

    Customer returns and exchanges

    Short Shipments

    Orders shipped incomplete

    Wrong Items

    Incorrect items shipped to customer

    Claims Processing Workflow

    Claim Initiation
    Documentation
    Investigation
    Resolution
    Credit/Replacement
    Case Closure

    Detailed Process:

    1. Claim Initiation: Customer or internal team initiates claim
    2. Documentation: Collect evidence (photos, delivery proof, etc.)
    3. Investigation: Research order history and determine cause
    4. Resolution Decision: Approve/deny claim and determine remedy
    5. Credit/Replacement: Process refund or ship replacement
    6. Case Closure: Close claim and update customer record

    Claims Database Structure

    Repository Purpose Key Fields
    ClaimReturnInputHeaderRepository Claim header information Claim ID, Customer, Date, Status
    ClaimReturnInputDetailRepository Individual claim items Item, Quantity, Reason, Resolution

    Claim Status Management

    Status Description Actions Available Next Steps
    Open Claim submitted, awaiting review Investigate, Request Info Document review
    Under Investigation Claim being researched Approve, Deny, Request More Info Investigation completion
    Approved Claim approved for resolution Process Credit, Ship Replacement Resolution processing
    Denied Claim denied Customer notification Case closure
    Resolved Claim resolution completed Close case Case closure

    Resolution Types

    Full Refund

    Complete refund of purchase price

    Credit Note

    Account credit for future purchases

    Replacement

    Ship replacement item at no charge

    Partial Credit

    Partial refund for damaged items

    Claims Analytics and Reporting

    The system provides comprehensive claims analytics:

    • Claims by Reason: Track common claim causes
    • Claims by Customer: Identify problematic accounts
    • Claims by Supplier: Quality issues by supplier
    • Resolution Time: Average time to resolve claims
    • Cost Analysis: Financial impact of claims
    • Trend Analysis: Claims trends over time
    Customer Service Integration: Claims processing is fully integrated with customer service systems, providing complete visibility into claim status and history.

    Core API Endpoints

    GET /api/health System health check
    GET /api/orders Retrieve orders
    POST /api/orders Create new order
    GET /api/orders/{id} Get specific order
    PUT /api/orders/{id}/status Update order status

    Documentation and Testing

    Swagger UI

    Interactive API documentation at /swagger-ui.html

    OpenAPI 3.0

    API specification at /v3/api-docs

    Health Checks

    Spring Boot Actuator endpoints for monitoring

    Security

    JWT authentication for all endpoints

    Database Connections

    Database Driver Purpose Status
    IBM i DB2 AS400JDBCDriver Primary ERP data (Bookmaster) Active
    PostgreSQL PostgreSQL JDBC Integration data and logs Optional
    MySQL MySQL Connector Web application data Optional
    SQL Server SQLServer JDBC Legacy system integration Optional

    Key AS400 Tables

    Core business data tables in the Bookmaster ERP system:

    • DSED* Tables: Sales order processing and customer data
    • DSPO* Tables: Purchase order and supplier management
    • XACTD00P: User management and authentication
    • AXI_EVENT: System messaging and notifications

    Customer-Specific Integrations

    Customer

    Amazon, Van Schaik, Exclusive Books, Takealot

    Customer

    LexisNexis, MyGate payments, Fraxion, Takealot

    Customer

    Academic distribution channels

    Courier Services

    Dawn Wing, Fastway, PostNet

    Windows Customers!!!!, Update and Build Commands

    Click on axigrate service, stop the service, then exit. As administrator on terminal, cd to to the root of the project and run update.bat. Click on axigrate service again, start the service, then exit.

    rem Clean and build the application
    @echo off
    SETLOCAL
    
    rem Update the axigrate project (branch = master)
    git pull
    
    rem Build the axigrate project
    mvn clean package spring-boot:repackage
    
    ENDLOCAL

    Build Commands

    # Clean and build the application
    mvn clean spring-boot:repackage
    
    # Run the application
    java -jar target/axigrate-0.0.1-SNAPSHOT.jar
    
    # Run with specific profile
    java -jar target/axigrate-0.0.1-SNAPSHOT.jar --spring.profiles.active=jbp_jbt

    Docker Deployment

    # Build Docker image
    docker build -t ax-axigrate .
    
    # Run with Docker Compose
    docker compose up -d
    docker compose logs -f

    Environment Profiles

    Profile Customer Environment Configuration File
    cst_env Customer Live application-cst_env.properties

    Key Configuration Properties

    # Database Configuration
    spring.datasource.url=jdbc:as400://hostname:port/library
    spring.datasource.username=${DB_USER}
    spring.datasource.password=${DB_PASSWORD}
    
    # Scheduling Configuration
    sales.inbound.scheduled=true
    purchasing.outbound.scheduled=true
    
    # Integration Settings
    app.root.dir=/path/to/data/directory
    email.smtp.host=mail.company.com