Email Integration and Receipt Processing for EasiB2B

The EasiB2B platform streamlines AWS email management and receipt processing to enhance organizational efficiency and ensure seamless transaction mapping.

Email Account Creation

· Creates an email account under AWS WorkMail using below format: {organization_name}_{VAT_number} Ex: orgnizationone_1234@rc-easib2b.com

Registration Emails

· Admin Notifications: Registration email sent to the admin includes receipt email address and password details

· Cardholder Notifications: Cardholders receive only receipt email address to forward receipts for recurrence transactions

Scheduled Email Process from Receipt Email Account

A scheduler is configured to run every 12 hours to fetch and process emails:

1. Fetch Users: Retrieves all the active users / email accounts (organization receipt account)

2. Email Login: Logs into user / email account (organization receipt account)

3. Process Emails:

a. Process last 7 days emails using IMAP

b. Log every success or failure record in database

4. Upload Attachments / Receipts into S3:

a. Upload successfully processed files / receipts into S3 bucket

b. Move successfully processed emails into an archive folder

c. Log every success or failure record in database

Scheduled Receipts Process from S3 Bucket

A scheduler runs every 12 hours to extract and analyze receipt files:

1. Fetch Files: Processes receipt files in S3, excluding those older than 7 days

2. Analyze Content:

PDF/ Image Files: Uses Amazon Textract to extract expense details from receipt.

a. Merchant name (using fuzzy matching)

b. Amount

c. Transaction date etc.,

3. Transaction Mapping: Matches extracted receipt details with transaction based on:

a. Email address

b. Merchant name (using fuzzy matching)

c. Amount

d. Transaction date

4. Date Conversion: Converts receipt dates to YYYY-MM-DD format to match transaction records

5. Update Receipt to Transaction: Update the receipt to the matched transaction

6. Log Results: Logs success or failure record in database and deletes processed files from S3

Save Receipt Details

Track the processing details into database based on the job ID with:

  • Organization name
  • Email
  • Status
  • Failure type
  • Receipt details
  • Retry Mechanisms
  • Retry Failed Emails

· Reprocess Emails: Invokes Organization email account to retry the failed emails at Organization level

Retry Failed Receipts

· Reprocess Receipts: Identifies failed jobs in receipt history and retries based on job id from S3

Notification Handling

· After a transaction is completed, cardholders receive a notification via email, prompting them to send receipts to their organization receipt email address.