Overview
Magento Order can be transferred from iPaaS.com using an Update sync method. This mapping supports the automated synchronization of Order records from iPaaS into Magento via the Order API (Transactions).
Mapping Collection Status
Mapping Status: Enabled.
Trigger Events: The sync is triggered by the update of Order in iPaaS.
ID Format: When manually syncing, the Transaction ID from iPaaS is used.
Conflicting Mappings: This mapping applies only to Order. Ensure no other mappings target the same Magento entity to prevent data from being overwritten.
Supported Child Collections
The integration supports the synchronization of the parent Order and its related child collections:
Order Line: Maps individual product line items.
Shipment Track: Maps shipments.
System Caveats
Magento
Updates are applied only to existing orders identified by their EntityId.
Order financial totals are not recalculated from iPaaS; these values are managed internally by Magento.
Comments and visibility settings are applied directly to order history.
iPaaS.com
Ensures valid order references through EntityId resolution before update.
Setup Requirements
Magento Configuration
Orders must already exist in Magento before updates are processed.
Status values sent from iPaaS must correspond to valid Magento order statuses.
iPaaS.com Configuration
Must provide EntityId for the order being update
Authentication & Security
Magento2 API UserName: Used to access iPaaS API for fetching Company and related data.
Magento2 API Key: Used to access iPaaS API for fetching Company and related data
Integration Flow
Trigger & Retrieve Data: iPaaS triggers the mapping when a transaction with Type == "Order" is identified.
Determine Order Operation:
If IsOrderUpdate == true, the mapping updates an existing Magento Order.
Otherwise, a new Order record is created.
Set Financial Flags: Configure Capture and Notify options dynamically.
Apply Comments: Insert or update Order comments with visibility and notification preferences.
Sync Line Items: For each Order item, map quantities, SKUs, and unique identifiers to Magento.
Mappings
Parent Collection: Order Update From iPaaS
Mapping Filter
var orderType = Type == "Order" ? true : false;
var hasOrder = true;
var transactionExternalId = await GetExternalIdAsync(Id, "Transaction", SpaceportSystemId);
if(transactionExternalId != null){
hasOrder = true;
}
if(orderType && hasOrder) {
return true;
}
else {
return false; }
Description:
The fields GrandTotal, Shipping Amount, SubTotal, and TotalQtyOrdered will not be honored during an order update from iPaaS. If incorrect values are populated in these fields, it may lead to issues with the order.
Mapping Type | Source (iPaaS.com) | Destination (Magento) | Description |
Dynamic Formula |
| DiscountAmount |
|
Dynamic Formula |
| EntityId | It retrieves the external ID of the created transaction and returns the sales order ID associated with that transaction, which we had previously saved as the external ID. |
Dynamic Formula |
| Status | The code snippet defines a variable orderStatus with a default value of "pending". It then checks the value of the Status variable and updates orderStatus based on specific conditions. If Status is "Pending", orderStatus is set to "processing". If Status is "Complete", it changes to "complete", and if Status is "Cancelled", it becomes "canceled". Finally, the function returns the updated value of orderStatus. |
Dynamic Formula |
| TaxAmount |
|
Dynamic Formula |
| Comment_Value | This mapping assigns a comment that will be appended to the original order’s comment section to provide order details. Note: If the comment value is null, no comment will be added to the order. |
Dynamic Formula |
| Comment_Is_Visible_On_Front | This mapping assigns the value that controls whether the comment is shown on the front end for the original order. If it is true, the comment will be displayed; otherwise, it will not be shown. |
Shipment Track From iPaaS (Child Collection)
Filter
var orderType = Type == "Order" ? true : false;
var hasOrder = true;
var transactionExternalId = await GetExternalIdAsync(Id, "Transaction", SpaceportSystemId);
if(transactionExternalId != null){
hasOrder = true;
}
if(orderType && hasOrder) {
return true;
}
else {
return false; }
Description
If the ShipmentItems mapping is not provided, the tracking process will assume all items should be shipped. To ship the entire order without specifying individual items, simply remove the ShipmentItems mapping and any associated filters.
Configuring Shipment Items
You can specify shipment item values using preset settings:
Shipment Items Field Separator – defines how individual field values (e.g., SKU and quantity) are separated within a record.
Shipment Items Record Delimiter – defines how multiple shipment item records are separated.
Example Configuration:
Shipment Items Record Delimiter: ,
Shipment Items Field Separator: |
Format: {Sku1}|{Quantity1},{Sku2|{Quantity2}
Example: DEMO1234|3,TEST5678|2
Mapping Type | Source (iPaaS.com) | Destination (Magento) | Description |
Field | return await GetOrderIdByOrderNumber(Parent.TransactionNumber); | OrderId | The statement asynchronously calls the function GetOrderIdByOrderNumber, passing in the TransactionNumber from the Parent object as an argument. It waits for the function to return a result, which is expected to be the corresponding order ID, and then returns that value. This ensures the calling process receives the correct order ID that matches the given transaction number. |
Field | TrackingNumber | TrackingNumber |
|
Dynamic Formula |
| Title |
|
Dynamic Formula |
| CarrierCode | Magento Adobe Commerce allows the following tracking carrier codes: custom, fedex, dhl, ups, and usps. |
Dynamic Formula |
| Comment_Value | This mapping assigns the comment that will be appended to the shipment. Note: If the comment value is null, no comment will be added to the shipment. |
Dynamic Formula |
| Comment_Is_Visible_On_Front | This mapping assigns the value to control whether the comment is shown on the front end. If it is true, the comment will be displayed; otherwise, it will not be shown. |
Dynamic Formula |
| Notify | This field indicates whether to notify the customer about shipments. If set to true, an email will be sent to the customer when the shipment is captured. |
Dynamic Formula |
| ShipmentItems | If the ShipmentItems mapping is not provided, the tracking process will assume all items should be shipped. To ship the entire order without specifying individual items, simply remove the ShipmentItems mapping and any associated filters. Configuring Shipment Items: You can specify shipment item values using preset settings: Shipment Items Field Separator – defines how individual field values (e.g., SKU and quantity) are separated within a record. Shipment Items Record Delimiter – defines how multiple shipment item records are separated. Example Configuration: Shipment Items Record Delimiter: , Shipment Items Field Separator: | Format: {Sku1}|{Quantity1},{Sku2}|{Quantity2} Example: DEMO1234|3,TEST5678|2 |
Dynamic Formula |
| Atrributes_SourceCode | This value represents a "source to ship" location, which may be defined in a custom field. The corresponding code for each "source to ship" location can be found in Magento under Stores → Inventory → Sources. |
Dynamic Formula |
| Order_Comment_Value | This mapping assigns a comment that will be appended to the original order’s comment section to provide shipment details. Note: If the comment value is null, no comment will be added to the order. |
Dynamic Formula |
| Order_Comment_Is_Visible_On_Front | This mapping assigns the value that controls whether the comment is shown on the front end for the original order. If it is true, the comment will be displayed; otherwise, it will not be shown. |
Dynamic Formula |
| Order_Comment_Is_Customer_Notified | This field indicates whether to notify the customer when an invoice has been added to the order. If set to true, an email will be sent to the customer when the invoice is captured for that order. |
Dynamic Formula |
| Order_Comment_Status | This mapping assigns the order status, which can be a custom status defined in Magento, such as "Complete," "Cancelled," or "Processing." Note: A defect in the Magento API does not allow setting custom order statuses with the "processing" state, despite the UI offering the same ability. Custom statuses should not be provided to this mapping until the API is corrected. |
Magento Transaction Line From iPaaS (Child Collection)
Mapping Type | Source (iPaaS.com) | Destination (Magento) |
Field | DiscountAmount | DiscountAmount |
Field | DiscountPercent | DiscountPercent |
Dynamic Formula |
| OriginalPrice |
Dynamic Formula | Qty | QtyOrdered |
Field | ExtendedPrice | RowTotal |
Dynamic Formula |
| Sku |
Field | EstimatedTaxAmount | TaxAmount |
Field | TaxPercent | TaxPercent |
Field | Weight | Weight |
Error Handling
Collection: Order (Parent)
Invalid or Missing EntityId
Resolution: Ensure EntityId correctly references an existing Magento order.
Invalid Financial Field Update
Resolution: Exclude GrandTotal, SubTotal, Shipping Amount, and TotalQtyOrdered fields from updates.
Collection: Shipment Track (Child)
Missing Order Reference
Resolution: Ensure OrderId is resolved successfully before shipment creation.
Invalid Carrier Code
Resolution: Validate the shipping method’s mapping to Magento’s carrier codes.
Validation Rules & Testing
Validation Checklist
Orders exist in Magento before updates.
EntityId is correctly resolved.
Shipment track and transaction lines are properly linked.
Comments and visibility flags align with customer communication rules.
Test Scenarios
Update Order Status: Send an order update to change the order status: Verify status updated in Magento.
Add Comment: Send order update with a new comment: Confirm comment appears in order history.
Create Shipment with Tracking: Send shipment data with tracking number: Verify tracking details appear in Magento.
Invalid Carrier Mapping: Send shipment with unrecognized shipping method: Expect “Invalid Carrier Code” error.
Additional Notes
Partial updates are supported: Only mapped fields will be updated, and all others remain unchanged.
