Overview
This document outlines the configuration for automatically synchronizing GiftCard Ticket records from the Magento Gift Card Ticket entity to the iPaaS Transaction entity. The integration uses an API-based sync that triggers whenever a Gift Card Ticket record is created in Magento.
Mapping Collection Status
Mapping Status: Enabled.
Trigger Events: The sync is triggered by the creation of GiftCard Tickets in Magento.
ID Format: When manually syncing, the GiftCard Ticket ID from iPaaS is used. This can be resolved via an external ID.
Conflicting Mappings: This mapping applies only to GiftCard Tickets. 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 Gift Card Ticket and its related child collections:
GiftCard Ticket Line: Transfers GiftCard Ticket line items details.
Deposit Payment Line: Transfers Gift Card Ticket Payment details.
GiftCard Ticket Payment - Gift Card: Transfers GiftCard Ticket Payment- Gift Card details.
GiftCard Ticket Tax: Transfers GiftCard Ticket Tax details.
System Caveats
Magento Caveats
Generates deposit orders ending in “-D”.
Excludes gift card (“-GC”) and fraudulent orders.
Provides all necessary totals and order details for deposit synchronization.
iPaaS Caveats
Receives deposit records with all associated child records (Lines, Payments, Taxes).
Sets the deposit record status to Pending by default.
Links GiftCard Tickets to their parent transactions via the ParentId field.
Setup Requirements
Magento Configuration
IncrementId: Must end with “-D”.
Status: Orders marked as “suspected_fraud” or “fraud” are excluded.
Subtotal, TaxAmount, ShippingAmount, DiscountAmount: Required for total calculation.
iPaaS Configuration
SystemId: Derived using SpaceportSystemId.
ParentId: Retrieved dynamically through lookup for transaction association.
Transaction Type: Always set as “Ticket”.
Status: Defaults to “Pending” at creation
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
Retrieve Data: Fetch orders from Magento matching the filter conditions.
Apply Filter: Only deposit transactions (IncrementId.EndsWith("-D")) are processed.
Map Fields: Populate fields such as TransactionNumber, Subtotal, Total, and Tax.
Resolve Parent Reference: Fetch related parent transaction via GetSpaceportParentTransactionIdAsync.
Send to iPaaS: Create GiftCard Ticket record with child records (Lines, Payments, and Taxes).
Mappings
GiftCard Ticket (Parent)
Filter
IncrementId.EndsWith("-GC")
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Field | EntityId | Mage Entity ID (custom field) |
Dynamic Formula |
| SystemId |
Field | IncrementId | TransactionNumber |
Dynamic Formula |
| ParentId |
Static | Ticket | Type |
Lookup Translation | Status | |
Field | CustomerEmail | EmailAddress |
Field | DiscountAmount | DiscountAmount |
Field | TaxAmount | TaxAmount |
Field | ShippingAmount | ShippingAmount |
Dynamic Formula |
| Subtotal |
Dynamic Formula |
| Total |
Dynamic Formula |
| TotalQty |
Dynamic Formula |
| TransactionCreatedDateTime |
GiftCard Ticket Line To iPaaS (Child Collection)
Filter
ProductType == "giftvoucher"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Field | giftcardshippedtorecipient (custom field) | Giftcard Shippedto Recipient (custom field) |
Field | giftcardnumber (custom field) | Giftcard Number (custom field) |
Field | giftcardcustommessage (custom field) | Giftcard Message (custom field) |
Dynamic Formula |
| LineInfo |
Dynamic Formula |
| Type |
Static | Complete | Status |
Dynamic Formula |
| Sku |
Field | Description | Description |
Field | QtyOrdered | Qty |
Dynamic Formula |
| UnitPrice |
Field | RowTotal | ExtendedPrice |
Field | OriginalPrice | OriginalUnitPrice |
Field | DiscountAmount | DiscountAmount |
Field | DiscountPercent | DiscountPercent |
Field | TaxPercent | TaxPercent |
Field | Weight | Weight |
Gift Card Ticket Payment To iPaaS (Child Collection)
Filter
Method != "giftcard"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Lookup Translation | Method | |
Field | Method | Description |
Dynamic Formula |
| Amount |
Dynamic Formula |
| Status |
GiftCard Ticket Payment To iPaaS -Gift Card (Child Collection)
Filter
Method=="giftcard"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Field | authcode (custom field) | AuthCode (custom field) |
Field | giftcardnumber (custom field) | Giftcard Number (custom field) |
Dynamic Formula |
| MethodInfo |
Lookup Translation | Method | |
Field | Method | Description |
Dynamic Formula |
| Amount |
Static | Captured | Status |
GiftCard Ticket Tax To iPaaS -Gift Card (Child Collection)
Filter
Method=="giftcard"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Dynamic Formula |
| Authority |
Dynamic Formula |
| Amount |
Lookup Translations
M2 Transaction Payment Method To iPaaS
Source Field (Magento) | Destination Field (iPaaS) |
authnetcim | CASH |
authorizenet | CASH |
braintree | CASH |
checkmo | CASH |
paypal_express | CASH |
purchaseorder | CASH |
giftcard | GC |
M2 Transaction Status To iPaaS
Source Field (Magento) | Destination Field (iPaaS) |
pending | Pending |
processing | Pending |
complete | Complete |
canceled | Cancelled |
completing | Complete |
ready_for_completion | Pending |
Error Handling
Collection: GiftCard Ticket (Parent)
Missing Parent Reference
Description: Unable to resolve parent transaction ID.
Resolution: Ensure parent transaction exists in iPaaS.
Invalid Amount Calculation
Description: One or more financial fields contain invalid data types.
Resolution: Validate numeric values in Subtotal, Tax, and Discount fields.
Collection: GiftCard Ticket Line (Child)
Missing SKU or Product Type
Resolution: Ensure all line items contain valid SKU and product type fields.
Collection: Payment (Child)
Payment Method Lookup Failure
Resolution: Verify the payment method exists in the M2 Transaction Payment Method Lookup mapping.
Validation Rules & Testing
Validation Rules
Transaction number ends with “-GC”.
Fraudulent and gift card orders excluded.
All totals (Subtotal, Tax, Shipping, Discount) correctly computed.
Payment and line details correctly linked to parent ticket.
Test Scenarios
Create a valid “-GC” order: GiftCard record should appear in iPaaS.
Send order with “-GC”: Skipped by filter.
Include invalid totals: Mapping should throw validation error.
Send payment with gift card: Routed to Gift Card Payment child mapping
Additional Notes
All child records (Line, Payment, Tax) must reference a valid parent via ParentId.
