Skip to main content

99minds Order Completed Workflow from iPaaS

Synchronize completed orders and return from iPaaS to 99Minds

Overview

This document outlines the workflow configuration for synchronizing completed Orders and Validated Returns from iPaaS into 99minds.
This workflow triggers when iPaaS marks an order or a validated return as Complete, ensuring that loyalty points, order totals, and refund amounts flow accurately into 99minds.

Mapping Collection Status

  • Mapping Status: Enabled.

  • Trigger Events: The sync is triggered Runs when an order or validated return in iPaaS reaches Status = Complete.

  • ID Format: When manually syncing, the Transaction ID from iPaaS is used.

  • Conflicting Mappings: This mapping applies only to Invoice. Ensure no other mappings target the same 99minds entity to prevent data from being overwritten.

System Caveats

iPaaS Caveats

  • Orders must contain valid TransactionNumber, CustomerId, Subtotal, and TotalQty.

  • Transactions with certain suffix modifiers (e.g., -D, -GC) should be excluded to avoid incorrect loyalty calculations.

99minds Caveats

  • 99minds expects a stable IdempotentId to avoid duplicate transaction creation.

  • Refund amounts and loyalty point reversals rely on correct logic based on order type.

  • Missing CustomerId or invalid mapping will prevent transaction creation.

Setup Requirements

99minds Configuration

  • OriginalOrderId: Must correspond to a valid 99minds order.

  • Invoice Entity: Must exist when updating; otherwise, iPaaS triggers creation.

  • Comment Fields: Must align with 99minds’s order comment visibility and notification fields.

iPaaS.com Configuration

  • Type: Must be explicitly set to "Invoice".

  • Qty: Specifies the number of units invoiced per line item.

  • TransactionLineEntityId: Used for unique identification of invoice lines.

Authentication & Security

  • 99minds2 API UserName: Used to access iPaaS API for fetching Company and related data.

  • 99minds2 API Key: Used to access iPaaS API for fetching Company and related data

Integration Flow

  1. Trigger & Retrieve Data: iPaaS triggers the mapping when a transaction with Type == "Order" or Validated Return is identified.

  2. Determine Operation: If transaction number does not end with ‘D’ or ‘-GC’, it updates the order.

  3. Map Transaction Identifiers: The TransactionNumber is mapped to the IdempotentId in the 99minds template to ensure uniqueness.

  4. Map Quantities & Totals: TotalQty is mapped to TotalQuantity in 99minds, ensuring accurate item count synchronization.

  5. Sync Line Items: For each invoiced item, map quantities, SKUs, and unique identifiers to 99minds.

  6. Create or Update Workflow Record: 99minds creates or updates the Order Completed workflow entry using the IdempotentId to avoid duplicates.

Mappings

Parent Collection: 99minds Invoice From iPaaS

Mapping Filter

(Type == "Order" || Type == "Validated Return")
&& Status == "Complete"
&& !TransactionNumber.EndsWith("-D")
&& !TransactionNumber.EndsWith("-GC")

Description

Adjust filter as needed to limit orders from specific sources.

Mapping Type

Source (iPaaS.com)

Destination (99minds)

Description

Dynamic Formula

TransactionNumber

IdempotentId

Dynamic Formula

var customerId = await GetExternalIdAsync(CustomerId, "Customer", SpaceportSystemId); if (customerId == null || customerId == "") return await GetCustomerIdByEmail(EmailAddress); else return customerId ;

CustomerId

Dynamic Formula

if (Type == "Order" && Total >= 0) return "order_paid"; if (Type == "Validated Return" || Total < 0) return "order_refunded"; return null;

Trigger

Dynamic Formula

if (Type == "Validated Return" || Total < 0) return null; if (Total >= 0) return Total; return null;

TotalPrice

Adjust the total formula to indicate sale (not refund) amounts based on your iPaaS transaction types.

Dynamic Formula

Subtotal

SubtotalPrice

Dynamic Formula

TotalQty

TotalQuantity

Dynamic Formula

var value = GetCustomFieldValue(CustomFields, "99minds Points Earned / Used"); if (value != null && value != "") return ConvertToInt(value); else return null;

LoyaltyPointsClaimed

Dynamic Formula

if (Type == "Order" && Total >= 0) return null; if (Type == "Validated Return" || Total < 0) return Total; return null;

RefundAmount

Adjust the refund amount formula to indicate refund(not sale) amounts based on your iPaaS transaction types

Error Handling

Missing CustomerId

Unable to resolve customer.

  • Description: Customer lookup failed in iPaaS or 99minds.

  • Resolution: Ensure customer exists and mapping is correct.

Unsupported Transaction Type

Type is not Order or Validated Return.

  • Resolution: Check mapping filter or source system configuration.

Excluded Transaction (Suffix Match)

TransactionNumber ends with -D or -GC.

  • Resolution: Expected behavior—these are intentionally filtered.

Invalid Refund Data

ReturnAmount missing for Validated Return.

  • Resolution: Confirm return processing workflow populates the correct fields.

Validation Rules & Testing

Validation Checklist

  • Order and Return Types: Ensure only Orders and Validated Returns with Status = Complete are processed.

  • Exclusion Rules: Confirm transactions ending with “-D” or “-GC” are skipped.

  • IdempotentId Accuracy: Verify IdempotentId matches the iPaaS TransactionNumber and prevents duplicates.

  • Customer Resolution: Check that a valid 99minds CustomerId is returned for each processed order.

  • Price Calculations: Confirm TotalPrice and SubtotalPrice values accurately match iPaaS source values, including negative adjustments for returns.

  • Quantity Mapping: Ensure TotalQuantity correctly reflects the iPaaS TotalQty value.

  • Refund Handling: Ensure RefundAmount is populated only for Validated Returns and equals the correct refunded value.

Test Scenarios

  1. Completed Order Sync: Create a new order in the source system, allow it to reach iPaaS, mark it as Complete, and verify that a corresponding order record is created in 99minds with accurate TotalPrice, SubtotalPrice, TotalQuantity, and LoyaltyPointsClaimed.

  2. Validated Return Sync: Create a validated return in iPaaS, mark it as Complete, and confirm that 99minds receives a return transaction with the correct negative TotalPrice, correct refund amount, and reversed loyalty points.

  3. Exclusion Filter Check: Use an order whose TransactionNumber ends with “-D” or “-GC”, mark it Complete, and verify that the workflow does not create a record in 99minds.

  4. Customer Resolution Failure: Trigger the workflow with an order whose CustomerId cannot be resolved in 99minds and confirm that no transaction is created and appropriate error logging occurs.

  5. Duplicate Prevention: Re-run the workflow using the same TransactionNumber and verify that 99minds does not create a duplicate transaction due to IdempotentId enforcement.

  6. Field Mapping Verification: Sync a completed order with known Subtotal, TotalQty, and Total values, and verify that all mapped fields appear correctly in 99minds.

Additional Notes

  • This workflow handles both completed orders and validated returns.

Did this answer your question?