n8n-nodes-myob
Version:
Simple n8n node to create sales orders in MYOB Business API with multiple line items
1,020 lines (827 loc) ⢠66 kB
Markdown
# Changelog
All notable changes to this project will be documented in this file.
## [0.5.29] - 2025-09-02
### š§ **FIXED SKU TRANSFORMATION LOGIC FOR NULL VALUES**
- **Null SKU Preservation**: Fixed transformation logic to preserve null/empty SKU values instead of prematurely replacing with default SKU
- **Proper Fallback Routing**: Now correctly routes null SKUs to the "No SKU provided" logic path instead of the "valid SKU" path
- **Description Priority Fix**: Ensures Shopify descriptions are properly prioritized when SKU is null by preserving the original SKU state during transformation
- **Logic Flow Correction**: Fixed the core issue where null SKUs were being replaced with default SKU during transformation, causing wrong logic path execution
### Fixed
- **SKU Transformation**: Changed from `defaultSku` to `null` when original SKU is null/empty during transformation phase
- **Logic Path Routing**: Null SKUs now correctly go through the "else" branch (No SKU provided) instead of the "if" branch (valid SKU)
- **Description Priority**: Shopify descriptions now properly preserved for null/empty SKU scenarios
- **Fallback Logic**: Default SKU fallback now correctly prioritizes Shopify description over MYOB description
### Technical
- **Transformation Phase Fix**: `const itemSku = (shopifyItem.sku && shopifyItem.sku.trim() !== '') ? shopifyItem.sku.trim() : null;`
- **Processing Phase Logic**: Null SKUs now correctly trigger the "No SKU provided" branch at line 417
- **Description Preservation**: Maintains original null status so description priority logic works correctly
- **Fallback Chain**: Proper execution of Shopify ā MYOB description priority for null SKUs
### Root Cause Analysis
```
PREVIOUS LOGIC FLOW (BROKEN):
Shopify SKU: null ā Transform to defaultSku ā if (defaultSku) branch ā Uses MYOB description
NEW LOGIC FLOW (FIXED):
Shopify SKU: null ā Transform to null ā else branch ā Prioritizes Shopify description
```
### Example Behavior
```
Shopify Line Item:
{
"name": "Replacement Decora Switch Icon House text Room Off",
"sku": null
}
ā BEFORE (0.5.28): "New Item" (wrong logic path)
ā
AFTER (0.5.29): "Replacement Decora Switch Icon House text Room Off" (correct path)
```
### Status
- ā
**Null SKU Logic Path Fixed**
- ā
**Shopify Description Priority Restored**
- ā
**Transformation Logic Corrected**
- ā
**All Previous Features Maintained**
## [0.5.28] - 2025-09-02
### š§ **FIXED NULL SKU DESCRIPTION PRIORITY**
- **Null SKU Handling**: Fixed description priority when Shopify SKU is null/empty and falls back to default SKU
- **Shopify Description Preservation**: Now correctly prioritizes Shopify product names over MYOB descriptions when using fallback SKU
- **Logic Reordering**: Changed the condition order to check for Shopify description first, then fall back to MYOB if truly empty
- **Better Product Representation**: Null/empty SKUs now preserve meaningful product names from Shopify instead of generic MYOB descriptions
### Fixed
- **Condition Priority**: Reordered the logic to check `if (itemDescription && itemDescription.trim() !== '')` first
- **Null SKU Behavior**: When SKU is null, the node now uses Shopify product name instead of MYOB default description
- **Description Flow**: Fixed the logical flow to properly preserve external product names for fallback scenarios
### Technical
- **Logic Restructure**: Changed from negative condition checking to positive condition checking
- **Priority Enforcement**: Always check for Shopify description availability before falling back to MYOB
- **Consistent Behavior**: All fallback scenarios now follow the same description priority logic
- **Enhanced Logging**: Improved console messages to show description decision process
### Example Behavior
```
Shopify Line Item:
{
"name": "Replacement Decora Switch Icon House text Room Off",
"sku": null
}
MYOB Default SKU: "Misc. Automation" (Description: "New Item")
ā
BEFORE: Used "New Item" (MYOB default description)
ā
AFTER: Uses "Replacement Decora Switch Icon House text Room Off" (Shopify name)
```
### Status
- ā
**Shopify Description Priority for Null SKUs**
- ā
**Proper Logic Flow for Fallback Scenarios**
- ā
**Meaningful Product Names Preserved**
- ā
**All Previous Features Maintained**
## [0.5.27] - 2025-09-02
### š§ **FIXED SHOPIFY NAME FIELD PRIORITY**
- **Shopify Field Priority**: Now prioritizes 'name' field over 'title' field for Shopify line items
- **Correct Data Extraction**: Fixed description extraction to use the correct Shopify field structure
- **Product Name Accuracy**: Line items now use the proper product name from Shopify's 'name' field
- **Enhanced Compatibility**: Better handling of Shopify webhook data structure
### Fixed
- **Field Priority Order**: Changed from `shopifyItem.title || shopifyItem.name` to `shopifyItem.name || shopifyItem.title`
- **Shopify Data Structure**: Now correctly prioritizes the 'name' field which is the primary product name field in Shopify line items
- **Description Building**: Improved description construction using the correct Shopify field hierarchy
### Technical
- **Data Mapping**: Updated Shopify line item mapping to use 'name' as primary field
- **Field Hierarchy**: Now follows correct priority: name ā title ā description
- **Better Integration**: Improved compatibility with Shopify webhook data format
### Example Behavior
```
Shopify Line Item:
{
"name": "Replacement Decora Switch Icon House text Room Off",
"title": "Switch",
"variant_title": "Black"
}
ā
BEFORE: Used "Switch" (title field)
ā
AFTER: Uses "Replacement Decora Switch Icon House text Room Off" (name field)
Final Description: "Replacement Decora Switch Icon House text Room Off - Black"
```
### Status
- ā
**Shopify 'name' Field Prioritized**
- ā
**Correct Product Name Extraction**
- ā
**Enhanced Shopify Compatibility**
- ā
**All Previous Features Maintained**
## [0.5.26] - 2025-09-02
### š§ **FIXED DESCRIPTION PRIORITY FOR DEFAULT SKU FALLBACKS**
- **Shopify Description Priority**: When falling back to default SKU, now prioritizes Shopify descriptions over MYOB descriptions
- **Consistent Logic**: Exact SKU matches use MYOB descriptions, fallback scenarios preserve original Shopify product descriptions
- **Improved Product Accuracy**: Non-matching SKUs maintain their descriptive product names from Shopify instead of generic default SKU descriptions
- **Enhanced Logging**: Added detailed console logs showing when Shopify vs MYOB descriptions are used for fallback scenarios
### Fixed
- **Default SKU Description Logic**: Fallback scenarios now check if Shopify description exists before using MYOB default SKU description
- **Product Name Preservation**: Items using default SKU now keep meaningful product names from source data
- **Description Override Priority**: Only uses MYOB description for default SKU when Shopify description is empty or missing
### Technical
- **Smart Fallback Logic**: Added condition to check if Shopify description exists before overriding with MYOB description
- **Three-tier Priority**: 1) Shopify description (if present), 2) MYOB Description field, 3) MYOB Name field
- **Consistent Implementation**: Applied same logic to all default SKU fallback scenarios (SKU not found, API errors, empty SKU)
- **Enhanced Debugging**: Console logs clearly indicate which description source is being used and why
### Example Behavior
```
Shopify Item: "Custom Neon Sign - Red", SKU: "CUSTOM-001" (not found in MYOB)
Default SKU: "DEFAULT-ITEM" (MYOB description: "new item")
ā
BEFORE: Used "new item" (MYOB default SKU description)
ā
AFTER: Uses "Custom Neon Sign - Red" (preserves Shopify description)
Shopify Item: No description, SKU: "MISSING-SKU" (not found in MYOB)
Default SKU: "DEFAULT-ITEM" (MYOB description: "Standard Item")
ā
Uses "Standard Item" (MYOB description as fallback when Shopify empty)
```
### Status
- ā
**Shopify Description Priority for Fallbacks**
- ā
**MYOB Description Only When Shopify Empty**
- ā
**Consistent Across All Fallback Scenarios**
- ā
**All Previous Features Maintained**
## [0.5.25] - 2025-08-28
### š **FIXED PRODUCT DESCRIPTION FIELD PRIORITY**
- **Description Field Priority**: Product descriptions now correctly prioritize MYOB `Description` field over `Name` field as requested
- **Line Items Fix**: For exact SKU matches, now uses `Description` first, falls back to `Name` only if Description is empty
- **Shipping Items Fix**: Shipping SKU descriptions also follow the same priority - `Description` field first, then `Name` as fallback
- **Business Logic Alignment**: Now properly uses the official MYOB product description field instead of name field
- **Consistent Behavior**: Both regular items and shipping items follow identical description field priority logic
### Fixed
- **Product Description Source**: Changed from prioritizing `Name` field to prioritizing `Description` field from MYOB API
- **Field Order**: `Description` ā `Name` ā Shopify description (previously was `Name` ā `Description` ā Shopify description)
- **Shipping Consistency**: Shipping items now use same description priority as regular line items
- **Console Logging**: Updated debug messages to reflect new field priority order
### Enhanced
- **Business Operations**: Now aligns with how MYOB product descriptions are typically used in business
- **Proper Field Usage**: Uses the intended MYOB field for product descriptions
- **Unified Logic**: All SKU-based lookups follow identical description field priority
- **Clear Fallback**: Name field only used when Description field is genuinely empty
### Technical
- **Field Priority Logic**: Updated both line items and shipping items to check Description field first
- **Fallback Chain**: Description ā Name ā Source description (Shopify/manual)
- **Debug Enhancement**: Console logs clearly show which MYOB field is being used
- **Consistent Implementation**: Same logic applied to all product lookup scenarios
### Example Behavior
```
MYOB Item:
- Name: "LED-STRIP"
- Description: "Premium LED Strip Light 4000K Daylight"
ā
OLD: Used "LED-STRIP" (Name field)
ā
NEW: Uses "Premium LED Strip Light 4000K Daylight" (Description field)
MYOB Item:
- Name: "P&P1"
- Description: "" (empty)
ā
Uses "P&P1" (Name field as fallback)
```
### Status
- ā
**Description Field Takes Priority Over Name Field**
- ā
**Business Logic Alignment**
- ā
**Consistent Line Items and Shipping Logic**
- ā
**All Previous Features Maintained**
## [0.5.22] - 2025-08-26
### š§ **FIXED SHIPPING DESCRIPTION LOGIC BUG**
- **Fixed Conditional Logic**: Corrected the shipping description condition that was preventing MYOB descriptions from being used properly
- **Simplified Logic**: Removed complex conditional that was causing fallback to manual description even when MYOB description was available
- **Proper Priority**: Now correctly always uses MYOB description when available, only falls back to manual when MYOB description is empty
- **Enhanced Console Logging**: Better debug messages to show which description source is being used
### Fixed
- **Shipping Description Bug**: Previous logic was not properly overriding manual descriptions with MYOB descriptions
- **Conditional Issue**: Fixed `else if` condition that prevented MYOB descriptions from taking priority
- **Logic Simplification**: Streamlined the description selection logic to work correctly
### Technical
- **Fixed Logic Flow**: Removed problematic `else if` condition that checked if manual description was empty
- **Proper Override**: MYOB description now properly overrides manual description when available
- **Clear Fallback**: Manual description only used when MYOB description is genuinely empty or missing
- **Better Debugging**: Console logs clearly show which description source is selected
### Example Fixed Behavior
```
Shipping SKU: "P&P1" (found in MYOB with description "Express Post")
Manual Description: "Standard Shipping"
ā
NOW USES: "Express Post" (MYOB description takes priority)
Shipping SKU: "P&P2" (found in MYOB with empty description)
Manual Description: "Standard Shipping"
ā
USES: "Standard Shipping" (fallback to manual when MYOB empty)
```
### Status
- ā
**MYOB Description Priority Fixed**
- ā
**Conditional Logic Corrected**
- ā
**Proper Fallback Behavior**
- ā
**All Previous Features Maintained**
## [0.5.21] - 2025-08-26
### š·ļø **CONSISTENT SHIPPING DESCRIPTION LOGIC**
- **Shipping SKU Description Priority**: Shipping lines now follow the same logic as regular items - MYOB description takes priority when SKU is found
- **Consistent Behavior**: All SKU lookups (regular items and shipping) now use MYOB descriptions for exact matches
- **Smart Fallback**: Manual shipping description only used when MYOB description is empty or missing
- **Enhanced Logging**: Added console logs showing when MYOB vs manual descriptions are used for shipping items
### Enhanced
- **Description Logic**: Shipping SKUs now prioritize MYOB item descriptions (same as regular line items)
- **Unified Behavior**: All SKU-based lookups follow the same description priority logic
- **Better Consistency**: Shipping and regular items handled identically for description selection
- **Improved Debugging**: Console logs show description source for shipping line items
### Technical
- **Consistent SKU Processing**: Shipping items use same lookup and description logic as regular items
- **MYOB Description Priority**: When shipping SKU found in MYOB, always use MYOB description first
- **Fallback Logic**: Manual shipping description used only when MYOB description unavailable
- **Enhanced Console Output**: Added logging for shipping description decision process
### Example Behavior
```
Shipping SKU: "P&P1" (found in MYOB with description "Standard Postage")
ā
Uses MYOB description: "Standard Postage"
Shipping SKU: "P&P2" (found in MYOB with empty description)
Manual Description: "Express Shipping"
ā
Uses manual description: "Express Shipping"
Shipping SKU: "CUSTOM-SHIP" (found in MYOB with description "Custom Shipping Service")
Manual Description: "Special Delivery"
ā
Uses MYOB description: "Custom Shipping Service" (MYOB takes priority)
```
### Status
- ā
**Shipping Description Logic Consistent with Items**
- ā
**MYOB Description Priority for All SKUs**
- ā
**Smart Fallback for Empty Descriptions**
- ā
**All Previous Features Maintained**
## [0.5.20] - 2025-08-24
### š§ **FIXED NO-SKU DESCRIPTION LOGIC**
- **Corrected No-SKU Behavior**: When no SKU is provided (empty string), now preserves Shopify description instead of using MYOB default description
- **Consistent Logic**: All fallback scenarios now preserve original Shopify descriptions - only exact SKU matches use MYOB descriptions
- **Better Product Representation**: Line items without SKUs still show meaningful product names from Shopify
- **Unified Behavior**: No-SKU scenario now behaves consistently with other fallback scenarios
### Fixed
- **No-SKU Description**: Empty SKU strings now preserve Shopify product descriptions instead of overriding with default SKU description
- **Consistent Fallback Logic**: All non-exact-match scenarios now consistently preserve source descriptions
- **Product Name Accuracy**: Items without SKUs maintain their descriptive names from Shopify
### Updated Behavior
```
Shopify Item: "Special Order Item", SKU: "" (empty)
ā
BEFORE: Used default SKU description from MYOB
ā
AFTER: Uses Shopify description "Special Order Item" + default SKU for accounting
Shopify Item: "Custom Product", SKU: undefined
ā
Uses Shopify description "Custom Product" + default SKU for accounting
```
### Status
- ā
**All Fallback Scenarios Use Source Descriptions**
- ā
**Only Exact SKU Matches Use MYOB Descriptions**
- ā
**Consistent Logic Across All Scenarios**
- ā
**All Previous Features Maintained**
## [0.5.19] - 2025-08-24
### šÆ **SMART DESCRIPTION PRIORITIZATION**
- **MYOB Description Priority**: When SKU matches exactly in MYOB, always use the MYOB item description (official product info)
- **Shopify Description Preserved**: When SKU fails and falls back to default SKU, preserve original Shopify description (actual product info)
- **Smart Logic**: Only override descriptions for exact SKU matches - fallback scenarios keep source descriptions
- **Enhanced User Experience**: Line items show meaningful descriptions - MYOB's for known items, Shopify's for unknown items
### Enhanced
- **Description Logic**: Exact SKU matches ā MYOB description, fallback scenarios ā preserve Shopify description
- **Better Data Accuracy**: Known products show official MYOB descriptions, unknown products show Shopify titles/variants
- **Intelligent Fallback**: When using default SKU, keeps the actual product description from Shopify
- **Business Logic**: Official catalog items use official descriptions, non-catalog items keep descriptive names
### Technical
- **Conditional Description Override**: Only applies MYOB descriptions for exact SKU matches
- **Fallback Preservation**: Default SKU scenarios preserve original item descriptions
- **Smart Detection**: Distinguishes between exact matches and fallback scenarios
- **Enhanced Logging**: Shows when MYOB vs Shopify descriptions are used
### Example Behavior
```
Shopify Item: "Premium LED Strip - 4000K Daylight", SKU: "LED-4000K"
ā
SKU Found: Uses MYOB description "LED Strip Light 4000K"
Shopify Item: "Custom Neon Sign - Blue", SKU: "CUSTOM-001" (not in MYOB)
ā
SKU Not Found: Uses Shopify description "Custom Neon Sign - Blue" + default SKU for pricing
Shopify Item: "Special Order Item", SKU: "" (empty)
ā
No SKU: Uses Shopify description "Special Order Item" + default SKU for accounting
```
### Use Cases
- ā
**Catalog Items**: Show official MYOB product descriptions for inventory matches
- ā
**Special Orders**: Preserve descriptive Shopify names for non-catalog items
- ā
**Custom Products**: Keep meaningful product names while using default SKU for accounting
- ā
**Mixed Orders**: Handle both catalog and non-catalog items intelligently
### Status
- ā
**Smart Description Logic Active**
- ā
**MYOB Priority for Exact Matches**
- ā
**Shopify Preservation for Fallbacks**
- ā
**All Previous Features Maintained**
## [0.5.18] - 2025-08-24
### š§ **FIXED DATE PRESERVATION ISSUE**
- **Fixed UTC Conversion**: Order dates now preserve the local date/time from input instead of converting to UTC
- **Date Preservation Logic**: Input `2025-08-24T04:32:01+10:00` now correctly becomes `2025-08-24T04:32:01.000Z` in MYOB
- **No More Date Shifting**: Eliminates the issue where August 24th became August 23rd due to timezone conversion
- **Enhanced Date Parsing**: Uses regex parsing to extract local date/time components directly from input
- **Fallback Handling**: Maintains robust fallback for various date input formats
### Fixed
- **UTC Date Conversion Issue**: Previously input dates were converted to UTC, causing date shifting
- **Date Component Preservation**: Now preserves the exact date and time values from user input
- **Timezone Handling**: Avoids JavaScript Date object timezone conversion issues
### Technical
- **Regex Date Parsing**: Uses pattern matching to extract date/time components directly
- **Local Date Preservation**: Constructs ISO string using original local date/time values
- **Enhanced Logging**: Console shows "preserved local date/time" for clarity
- **Fallback Logic**: Multiple parsing methods for different input formats
### Example Fix
```
Input: 2025-08-24T04:32:01+10:00
Old Output: 2025-08-23T18:32:01.000Z (UTC conversion)
New Output: 2025-08-24T04:32:01.000Z (preserved local)
```
### Use Cases
- **Multi-timezone Operations**: Date stays correct regardless of user's timezone
- **Historical Data**: Past dates maintain their intended date values
- **Future Scheduling**: Scheduled dates don't shift unexpectedly
- **Data Migration**: Import dates preserve original date intentions
### Status
- ā
**Local Date/Time Preservation**
- ā
**No UTC Conversion Issues**
- ā
**Enhanced Date Parsing Logic**
- ā
**All Previous Features Maintained**
## [0.5.17] - 2025-08-24
### š
**ADDED ORDER DATE INPUT FIELD**
- **Custom Order Date Support**: Added new "Order Date" input field allowing you to specify the exact date for sales orders
- **ISO Date Format Support**: Accepts dates in ISO format with timezone (e.g., `2025-08-24T04:32:01+10:00`)
- **Fallback to Timezone Logic**: If no date provided, falls back to current date in n8n configured timezone
- **Full DateTime Control**: Preserves the exact date and time from your input, including timezone offset
- **Flexible Input**: Optional field - works with existing workflows without changes
### Added
- **Order Date Field**: New optional string field for specifying sales order date
- **Date Validation**: Validates date format and shows clear error messages for invalid dates
- **Console Logging**: Shows which date is being used (provided vs. fallback) for debugging
- **Format Examples**: Placeholder text shows expected date format
### Enhanced
- **Date Control**: Full control over sales order dates instead of relying on automatic date generation
- **Integration Friendly**: Perfect for processing historical orders or scheduling future orders
- **Timezone Preservation**: Maintains timezone information from input date
- **Backward Compatible**: Existing workflows continue to work without modification
### Technical
- **Date Parsing**: Robust date parsing with proper error handling
- **ISO String Conversion**: Converts input dates to proper ISO format for MYOB API
- **Fallback Logic**: Smart fallback to timezone-adjusted current date when no date provided
- **Validation**: Comprehensive date validation with helpful error messages
### Use Cases
- **Historical Orders**: Create sales orders with past dates for data migration
- **Future Orders**: Schedule sales orders for future dates
- **Exact Timing**: Specify precise date and time for order creation
- **Multi-timezone**: Handle orders from different timezones with proper date handling
- **Automated Workflows**: Pass dates from external systems (Shopify, databases, etc.)
### Example Usage
```
Order Date: 2025-08-24T04:32:01+10:00
Result: MYOB receives 2025-08-24T04:32:01.000Z
Order Date: (empty)
Result: Uses current date in n8n timezone
```
### Status
- ā
**Custom Order Date Input Available**
- ā
**ISO Format with Timezone Support**
- ā
**Fallback to Timezone Logic Maintained**
- ā
**All Previous Features Maintained**
## [0.5.16] - 2025-08-24
### š **FIXED TIMEZONE HANDLING FOR SALES ORDER DATES**
- **Fixed Date Timezone Issue**: Sales order dates now respect the n8n configured timezone instead of always using UTC
- **Localized Date Creation**: Date field in MYOB sales orders now uses the local date based on n8n timezone configuration
- **Business Logic Improvement**: Ensures sales orders are created with the correct business date regardless of server timezone
### Fixed
- **UTC Date Issue**: Previously all sales orders were created with UTC dates, now uses configured timezone
- **Date Accuracy**: Sales orders now show the correct date in MYOB based on business timezone
- **Timezone Awareness**: Node now properly respects n8n's timezone configuration for date calculations
### Technical
- **Enhanced Date Handling**: Uses `this.getTimezone()` to get n8n's configured timezone
- **Proper Date Conversion**: Converts current date to local timezone before formatting for MYOB API
- **ISO Format Preservation**: Maintains ISO date format required by MYOB while using correct local date
### Use Cases
- **Australian Business**: If n8n is configured for Australian timezone, sales orders created at 9 AM will use the correct Australian date
- **Multi-timezone Operations**: Businesses operating across timezones can ensure consistent date handling
- **Accurate Reporting**: MYOB reports will show correct creation dates matching business operations
### Status
- ā
**Timezone-Aware Date Creation**
- ā
**Respects n8n Configuration**
- ā
**Maintains MYOB API Compatibility**
- ā
**All Previous Features Maintained**
## [0.5.12] - 2025-08-10
### š§ **FIXED MYOB API RESPONSE HANDLING**
- **returnFullResponse Implementation**: Added `returnFullResponse: true` to HTTP requests to get complete response data
- **Status Code Handling**: Now properly captures and processes HTTP status codes from MYOB API
- **Response Body Extraction**: Correctly extracts response body from n8n's full response format
- **Success/Failure Detection**: Uses HTTP status codes to determine if sales order creation was successful
- **Enhanced Response Data**: Now returns status codes, status messages, and response headers
### Fixed
- **Missing MYOB Response Data**: MYOB API responses are now properly captured and returned
- **Success Detection**: Uses HTTP status codes (200-299) to determine success instead of relying on response body
- **Empty Response Handling**: Properly handles cases where MYOB returns success with empty body (201 Created)
- **GET Request Compatibility**: SKU lookup requests still work correctly with body extraction
### Added
- **returnFullResponse Flag**: Added to all HTTP requests to get complete response information
- **Status Code Validation**: Checks HTTP status codes to determine request success
- **Response Headers**: Now captures and returns HTTP response headers from MYOB
- **Enhanced Output Format**: Returns statusCode, statusMessage, and response headers
### Enhanced
- **Response Processing Logic**: Smart handling of full response format vs direct response format
- **Debugging Information**: Enhanced logging shows status codes and response structure
- **Success Determination**: More reliable success detection using HTTP standards
- **API Compliance**: Better alignment with REST API response patterns
### Technical
- **Full Response Format**: `{body, headers, statusCode, statusMessage}` handling implemented
- **Method-Specific Processing**: GET requests return body only, POST requests return full response
- **Transport Layer Enhancement**: Smart response format detection and extraction
- **Status Code Ranges**: 200-299 range used for success determination
### Example New Output Format
```json
{
"success": true,
"statusCode": 201,
"statusMessage": "Created",
"myobResponse": {
"UID": "12345678-1234-1234-1234-123456789012",
"Number": "SO-000123",
"Date": "2025-08-10T10:30:00Z"
},
"responseHeaders": {
"content-type": "application/json",
"x-myobapi-version": "v2"
},
"sentPayload": { /* original payload */ }
}
```
### Status
- ā
**MYOB API Response Data Now Captured**
- ā
**HTTP Status Code Based Success Detection**
- ā
**Complete Response Information Available**
- ā
**All Previous Features Maintained**
## [0.5.11] - 2025-08-10
### š **ENHANCED MYOB API RESPONSE DEBUGGING**
- **Comprehensive Request/Response Logging**: Added detailed logging throughout the API request/response cycle
- **Response Analysis**: Enhanced debugging to identify if MYOB API responses are being received but not passed through
- **Transport Layer Debugging**: Added extensive logging to the MyobApi.request.ts transport layer
- **Response Structure Analysis**: Detailed logging of response types, properties, and content
- **Sales Order Response Tracking**: Special logging for sales order creation responses to identify missing data
### Added
- **Detailed API Request Logging**: Logs method, URL, headers, and payload information
- **Response Type Analysis**: Logs response type, null/undefined checks, and object structure
- **Sales Order Specific Debugging**: Special analysis for sales order creation responses
- **Error Response Debugging**: Enhanced error logging with full error object details
- **Response Content Validation**: Checks for expected MYOB fields like UID and Number
### Enhanced
- **Troubleshooting Capabilities**: Much more detailed logging to identify response handling issues
- **n8n OAuth2 Wrapper Analysis**: Debugging to identify if the wrapper is filtering responses
- **Console Log Visibility**: All debugging info visible in n8n console logs
- **Response Comparison**: Analysis of what MYOB should return vs what's actually received
### Technical
- **Transport Layer Enhancement**: MyobApi.request.ts now includes comprehensive debugging
- **Response Processing Analysis**: Detailed logging of how n8n's OAuth2 wrapper handles responses
- **Error Handling Improvement**: Better error logging and analysis for API failures
- **Performance Monitoring**: Tracks request/response timing and data sizes
### Debug Output Examples
```
=== MYOB API REQUEST DEBUG ===
Method: POST
Full URL: https://api.myob.com/accountright/{guid}/Sale/Order/Item
Headers: [sanitized header info]
Body size: 1234 characters
=== SALES ORDER CREATION RESPONSE ANALYSIS ===
Expected MYOB response should contain UID, Number, Date, etc.
Actual response received: [response details]
=== MYOB API RESPONSE DEBUG ===
Response type: object
Response keys: ['UID', 'Number', 'Date', ...]
```
### Status
- ā
**Comprehensive API Debugging Active**
- ā
**Response Analysis Enhanced**
- ā
**Error Tracking Improved**
- ā
**All Previous Features Maintained**
## [0.5.10] - 2025-08-10
### š¼ļø **FIXED MYOB LOGO IN PACKAGE**
- **Fixed Logo Packaging**: MYOB logo PNG file now correctly included in npm package
- **Updated Build Process**: Build script now copies PNG files from nodes/ to dist/nodes/ directory
- **Resolved Icon Display**: Node icon will now display properly in n8n interface
- **Cross-Platform Build**: Updated build script to work with PowerShell for Windows compatibility
### Fixed
- **Missing Logo File**: PNG file not included in published package tar.gz archive
- **Build Process**: TypeScript compiler wasn't copying non-JS files
- **Icon Display**: Node showed generic icon instead of MYOB logo
### Added
- **Logo Copy Step**: Build script now includes PowerShell command to copy PNG files
- **Asset Pipeline**: Automated copying of image assets during build process
### Enhanced
- **Package Completeness**: All required assets now properly included in published package
- **Professional Appearance**: MYOB logo displays correctly in n8n node interface
- **Build Reliability**: More robust build process that handles all asset types
### Technical
- **Build Script Update**: Added `powershell "Copy-Item 'nodes/*.png' 'dist/nodes/' -ErrorAction SilentlyContinue"`
- **File Structure**: PNG files now properly copied to dist/nodes/ alongside compiled JS
- **Package Contents**: Both source (nodes/) and compiled (dist/) directories include logo file
### Status
- ā
**MYOB Logo Displays Correctly**
- ā
**Complete Asset Pipeline**
- ā
**Professional Node Appearance**
- ā
**All Previous Features Maintained**
## [0.5.9] - 2025-08-10
### š”ļø **SKU FALLBACK RESILIENCE**
- **Smart SKU Fallback**: When a SKU lookup fails, node now automatically falls back to the Default SKU instead of stopping execution
- **Improved Error Resilience**: No more workflow failures due to incorrect or missing SKUs from Shopify
- **Seamless Processing**: Orders continue to process even when some products have incorrect SKUs
- **Enhanced Console Logging**: Clear logs show when SKU fallback occurs for better troubleshooting
### Fixed
- **SKU Lookup Failures**: Node no longer fails with "Item with SKU 'WRONG-SKU' not found in MYOB" errors
- **Workflow Continuity**: Orders process successfully even with SKU mismatches
- **Automatic Recovery**: Falls back to default SKU for both missing SKUs and API lookup errors
### Added
- **Automatic SKU Fallback**: When primary SKU fails, automatically uses Default SKU
- **Enhanced Logging**: Console logs show SKU fallback process for debugging
- **Multiple Fallback Scenarios**: Handles empty SKUs, missing SKUs, and lookup failures
### Enhanced
- **Robust Order Processing**: Workflows continue running despite SKU issues
- **Better Error Handling**: Graceful fallback instead of hard failures
- **Updated Field Description**: Default SKU field now mentions fallback functionality
### Console Log Examples
```
ā
Normal: SKU 'VALID-SKU' found and processed
ā ļø Fallback: SKU 'WRONG-SKU' not found in MYOB, falling back to default SKU 'DEFAULT-ITEM'
ā ļø Fallback: No SKU provided for item, using default SKU 'DEFAULT-ITEM'
ā ļø Fallback: Failed to lookup SKU 'NETWORK-ERROR': Connection timeout, falling back to default SKU 'DEFAULT-ITEM'
```
### Use Cases
- **Shopify Integration**: Handle product SKU mismatches without stopping order processing
- **Data Quality Issues**: Continue processing even with incomplete product data
- **API Reliability**: Graceful handling of network/API errors during SKU lookups
- **Development/Testing**: Use default SKU for testing without requiring exact SKU matches
### Technical
- **Fallback Logic**: Automatically tries Default SKU when primary SKU fails
- **Error Classification**: Distinguishes between SKU not found vs API errors
- **Multiple Recovery Paths**: Handles various failure scenarios gracefully
- **Preserved Functionality**: All existing features maintained with added resilience
### Status
- ā
**Automatic SKU Fallback Active**
- ā
**Improved Workflow Resilience**
- ā
**Enhanced Error Recovery**
- ā
**All Previous Features Maintained**
## [0.5.8] - 2025-08-10
### š **FIXED DISCOUNT CALCULATION + SHIPPING DESCRIPTION**
- **Fixed Discount Percentage Calculation**: Now calculates discount percentage based on total line value (unit price Ć quantity) instead of just unit price
- **Added Shipping Description Field**: New optional field to set custom description for shipping line items
- **Correct Multi-Quantity Discounts**: Fixes issue where items with quantity > 1 had incorrect discount percentages
- **Enhanced Shipping Control**: Can now override shipping item description or use MYOB defaults
### Fixed
- **Discount Calculation**: For items with quantity > 1, discount percentage now calculated correctly
- Old: `(discountAmount / unitPrice) * 100`
- New: `(discountAmount / (unitPrice Ć quantity)) * 100`
- **Example**: $4.80 discount on 2Ć$24.00 items now shows 10% instead of 20%
### Added
- **Shipping Description Field**: Optional field to customize shipping line item description
- **Enhanced Debug Logging**: Shows unit price, quantity, and total line value in discount calculations
### Enhanced
- **Accurate Discount Percentages**: Multi-quantity line items now show correct discount percentages in MYOB
- **Better Shipping Control**: Choose between custom shipping description or MYOB item defaults
- **Improved Calculations**: More detailed logging shows the complete discount calculation process
### Example Fixed Calculation
```
Shopify Data:
- Item: Windscreens, Price: $24.00, Quantity: 2, Discount: $4.80
- Total Line Value: $48.00
Old Calculation: 4.80 / 24.00 * 100 = 20% ā
New Calculation: 4.80 / 48.00 * 100 = 10% ā
Console Log: "Converted discount amount 4.80 to percentage: 10% (unit price: 24, quantity: 2, total line value: 48)"
```
### Technical
- **Proper Line Total Calculation**: Discount percentage based on (unit price Ć quantity)
- **Shipping Description Parameter**: New `shippingDescription` field added to node interface
- **Enhanced Debugging**: More comprehensive logging for discount calculation troubleshooting
### Status
- ā
**Correct Multi-Quantity Discount Percentages**
- ā
**Custom Shipping Descriptions Available**
- ā
**Enhanced Discount Calculation Logging**
- ā
**All Previous Features Maintained**
## [0.5.7] - 2025-08-10
### šÆ **CORRECT DISCOUNT FIELD - BUSINESS API V2 COMPLIANT**
- **Fixed Discount Field**: Changed from discount amount to `DiscountPercent` to match MYOB Business API v2 specification
- **Automatic Percentage Conversion**: Now converts Shopify discount amounts to percentages automatically
- **Proper API Compliance**: Uses correct field structure from MYOB Business API v2 documentation
- **Smart Calculation**: Calculates discount percentage as (discountAmount / unitPrice) * 100
- **Enhanced Logging**: Added conversion logging to show discount amount ā percentage calculation
### Fixed
- Discount field now uses `DiscountPercent` (percentage) instead of flat discount amount
- Proper API compliance with MYOB Business API v2 Sale/Order/Item endpoint
- Automatic conversion from Shopify discount amounts to MYOB discount percentages
### Added
- Automatic discount amount to percentage conversion
- Enhanced logging showing discount conversion process
- Precision rounding to 2 decimal places for discount percentages
- Safety checks to prevent division by zero
### Enhanced
- **Shopify Compatibility**: Seamlessly converts Shopify flat discount amounts to MYOB percentages
- **API Accuracy**: Now follows exact MYOB Business API v2 field specifications
- **Better Debugging**: Logs show both original amount and calculated percentage
### Example Conversion
```
Shopify: $31.35 discount on $97.00 item
MYOB: 32.32% discount (31.35 / 97.00 * 100)
Console Log: "Converted discount amount 31.35 to percentage: 32.32% (price: 97.00)"
```
### Technical
- Uses MYOB Business API v2 Sale/Order/Item field structure
- Prevents errors by checking unitPrice > 0 before conversion
- Rounds percentages to 2 decimal places for precision
- Maintains backward compatibility with existing workflows
### Status
- ā
**MYOB Business API v2 Compliant Discount Field**
- ā
**Automatic Amount-to-Percentage Conversion**
- ā
**Enhanced Conversion Logging**
- ā
**All Previous Features Maintained**
## [0.5.6] - 2025-08-10
### š§ **DISCOUNT FIELD FIX + PAYLOAD VISIBILITY**
- **Fixed Discount Field Case**: Changed discount field from `"Discount"` to `"discount"` (lowercase) to match MYOB EXO API documentation
- **Added Payload to Output**: Node output now includes the exact payload sent to MYOB for debugging purposes
- **Enhanced Output Structure**: Output now shows both MYOB response and sent payload for complete transparency
- **Better Debugging**: Can now see exactly what data is being sent to MYOB API
### Fixed
- Discount field case sensitivity (`"discount"` instead of `"Discount"`) based on MYOB EXO API docs
- Output structure now includes complete payload information
### Added
- `sentPayload` field in node output showing exact data sent to MYOB
- `myobResponse` field containing the API response from MYOB
- Enhanced output structure for better debugging and transparency
### Enhanced
- **Complete Visibility**: See both what was sent and what was received
- **Better Troubleshooting**: Full payload visibility helps identify API issues
- **API Compliance**: Lowercase field names matching MYOB EXO documentation
### Output Structure Example
```json
{
"success": true,
"myobResponse": { /* MYOB API Response */ },
"sentPayload": {
"OrderType": "Item",
"Lines": [
{
"discount": 31.35,
"UnitPrice": 97.00,
/* ... other fields */
}
]
}
}
```
### Status
- ā
**Lowercase Discount Field (EXO API Compliant)**
- ā
**Complete Payload Visibility in Output**
- ā
**Enhanced Debugging Capabilities**
- ā
**All Previous Features Maintained**
## [0.5.5] - 2025-08-10
### š **DISCOUNT DEBUGGING ENHANCED**
- **Enhanced Discount Debugging**: Added detailed console logs for discount calculation process
- **Improved Discount Tracing**: Better visibility into Shopify discount data processing
- **Debug Logging**: Console logs now show:
- Item processing details (SKU, price)
- Discount allocations array content
- Total discount fallback values
- Individual discount allocation amounts
- Final calculated discount amount
### Added
- Comprehensive discount debugging with console.log statements
- Step-by-step discount calculation visibility
- Enhanced troubleshooting capabilities for discount issues
### Enhanced
- **Discount Calculation Transparency**: Full visibility into discount processing logic
- **Better Troubleshooting**: Console logs help identify where discount calculations may fail
- **Debug Information**: All discount-related data logged for analysis
### Technical
- Added console.log statements throughout discount calculation process
- Improved debugging workflow for discount-related issues
- Better error tracing for Shopify discount integration
### Debug Output Example
```
Processing item: LED-FLEX-3K Price: 97.00
Discount allocations: [{"amount": "31.35"}]
Total discount: undefined
Adding discount allocation: 31.35
Final discount amount: 31.35
```
### Status
- ā
**Enhanced Discount Debugging Active**
- ā
**Console Logging for Troubleshooting**
- ā
**All Previous Features Maintained**
## [0.5.4] - 2025-08-10
### š§ **DISCOUNT FIELD CORRECTION**
- **Fixed MYOB Discount Field**: Corrected discount field name from `DiscountAmount` to `Discount` for proper MYOB API compatibility
- **Verified Output**: Confirmed JSON output display in n8n interface shows complete MYOB API response
- **Discount Integration**: Now properly applies Shopify discount amounts using correct MYOB field name
### Fixed
- MYOB API discount field name (`Discount` instead of `DiscountAmount`)
- Discount amounts now properly applied to MYOB sales order line items
- JSON output correctly displays MYOB API response in n8n interface
### Technical
- Corrected field mapping for MYOB Business API discount structure
- Maintained all existing discount calculation logic
- Output handling confirmed working for JSON display
### Status
- ā
**Correct MYOB Discount Field Name**
- ā
**Shopify Discounts Applied to MYOB**
- ā
**JSON Output Display Working**
- ā
**All Previous Features Maintained**
## [0.5.3] - 2025-08-10
### š° **SHOPIFY DISCOUNT SUPPORT & IMPROVEMENTS**
- **Shopify Discount Integration**: Automatically extracts and applies Shopify discount amounts to MYOB line items
- **Smart Discount Detection**: Supports both `discount_allocations` array and `total_discount` fallback
- **MYOB Discount Field**: Adds `DiscountAmount` field to line items when discounts are present
- **Clean Shipping Items**: Shipping line items no longer include blank descriptions (uses MYOB inventory default)
- **Enhanced JSON Output**: Node now returns the complete MYOB API response as JSON for better integration
### Added
- **Discount Amount Processing**: Calculates total discount per line item from Shopify data
- **DiscountAmount Field**: Adds discount amounts directly to MYOB sales order line items
- **Shopify discount_allocations Support**: Handles multiple discount applications per line item
- **Complete API Response**: Returns full MYOB API response for downstream processing
### Enhanced
- **Discount Calculation**: Automatically sums all discount allocations per line item
- **Fallback Logic**: Uses `total_discount` if `discount_allocations` not available
- **Clean Integration**: Shipping items use MYOB inventory descriptions (no blank overrides)
- **Better Output**: Full JSON response from MYOB API for better workflow integration
### Technical
- **Discount Processing**: Robust parsing of Shopify discount structures
- **Error Handling**: Graceful handling of missing discount data
- **API Response**: Complete MYOB response preserved in node output
- **Performance**: Efficient discount calculation with reduce operations
### Example Discount Processing
```
Shopify Line Item:
- Price: $33.00
- Discount Allocations: [{"amount": "31.35"}]
- Result: MYOB Line Item with $31.35 discount
Multiple Discounts:
- discount_allocations: [{"amount": "10.00"}, {"amount": "5.50"}]
- Result: Total discount of $15.50 applied to MYOB
```
### Status
- ā
**Shopify Discount Support Working**
- ā
**MYOB Discount Field Integration**
- ā
**Clean Shipping Line Items**
- ā
**Complete JSON Output Response**
- ā
**Multiple Discount Types Supported**
## [0.5.2] - 2025-08-10
### š ļø **FINAL BUG FIXES & API CORRECTION**
- **Fixed MYOB API Field**: Corrected Purchase Order field from `CustomerPO` and `PurchaseOrderNumber` to the correct `CustomerPurchaseOrderNumber`
- **Removed Duplicate Field**: Eliminated redundant "Customer PO Number" field - now only one "Purchase Order Number" field
- **Enhanced Execution Control**: Improved handling of multiple input items to prevent duplicate sales order creation
- **Single Sales Order Guarantee**: Node now processes all input data as a single sales order execution
### Fixed
- Correct MYOB API field mapping for Purchase Order Number (`CustomerPurchaseOrderNumber`)
- Removed duplicate purchase order fields causing confusion
- Multiple sales order creation issue (final fix)
- Input data processing to handle single execution properly
### Changed
- **Purchase Order Field**: Now uses correct MYOB API field `CustomerPurchaseOrderNumber`
- **Cleaner UI**: Removed redundant "Customer PO Number" field
- **Better Documentation**: Field descriptions updated for clarity
### Technical
- Improved input data validation and processing
- Enhanced error handling for edge cases
- Better execution flow control
### Status
- ā
**Correct Purchase Order Field Working**
- ā
**Single Sales Order Creation Guaranteed**
- ā
**Hash Symbol Auto-Removal Working**
- ā
**Multiple Line Items Per Order Working**
- ā
**Clean UI with Single Purchase Order Field**
## [0.5.1] - 2025-08-09
### š **CRITICAL BUG FIXES**
- **Fixed Multiple Sales Orders**: Node was creating 3 sales orders instead of 1 - now creates exactly one per execution
- **Fixed Purchase Order Number**: Purchase Order Number was missing from MYOB payload - now properly included
- **Added # Symbol Removal**: Automatically removes # symbol from Purchase Order Number (e.g., "#831811-HAS" becomes "831811-HAS")
- **Fixed Execution Loop**: Removed unnecessary loop that was processing each line item as separate sales order
### Fixed
- Multiple sales order creation issue (was creating one per line item)
- Purchase Order Number field not being sent to MYOB API
- Hash (#) symbol handling in Purchase Order Number
- Node execution structure to process single sales order with multiple line items
### Technical
- Simplified execution to process only first input item
- Fixed payload construction to include cleanedPurchaseOrderNumber
- Improved field processing and validation
- Better error handling for edge cases
### Status
- ā
**Single Sales Order Creation Working**
- ā
**Purchase Order Number Field Working**
- ā
**Hash Symbol Auto-Removal Working**
- ā
**Multiple Line Items Per Order Working**
## [0.5.0] - 2025-08-09
### š **MAJOR FEATURE UPDATE: SHIPPING & ORDER ENHANCEMENTS!**
- **Shipping Address Support**: Added 5 separate shipping address line fields that combine with newlines
- **Automatic Shipping Line Item**: Added shipping SKU and price fields - automatically added as last line item
- **Enhanced Order Fields**: Added Journal Memo, Comment, and Purchase Order Number fields
- **Complete Order Management**: Full support for comprehensive sales order creation
- **Shopify Shipping Ready**: Perfect for processing Shopify orders with shipping costs and addresses
### Added
- **Shipping Address Lines 1-5**: Separate fields that automatically combine with proper newlines (`\r\n`)
- **Shipping SKU Field**: Automatically looks up shipping item (e.g., P&P1, P&P2) and adds as line item
- **Shipping Price Field**: Sets unit price for shipping line item
- **Journal Memo Field**: Internal memo for journal entries
- **Comment Field**: Order comments and notes
- **Purchase Order Number Field**: Additional PO reference field
### Enhanced
- **Smart Shipping Address Building**: Follows your existing logic - only adds non-empty lines with newlines
- **Automatic Shipping Line Item**: If shipping SKU provided, automatically adds as last line item with quantity 1
- **Tax Code Support**: Shipping line items use default tax code UID when provided
- **Complete Order Data**: Supports all essential sales order fields for full integration
### Technical
- **Newline Handling**: Uses proper `\r\n` newline characters for MYOB compatibility
- **SKU Lookup**: Shipping SKUs go through same validation and lookup process as regular items
- **Error Handling**: Clear error messages if shipping SKU not found in MYOB
- **Optional Fields**: All new fields are optional - won't break existing workflows
### Use Cases
- ā
**Shopify Orders**: Complete order processing including shipping addresses and costs
- ā
**E-commerce Integration**: Handle shipping, taxes, and order metadata seamlessly
- ā
**Custom Shipping Items**: Use your existing P&P1, P&P2 SKUs for shipping costs
- ā
**Complete Order Tracking**: Journal memos, comments, and PO numbers for full audit trail
- ā
**Address Management**: Multi-line shipping addresses properly formatted
### Field Mapping Example
```
Shipping Line 1: "123 Main Street"
Shipping Line 2: "Unit 5"
Shipping Line 3: "Business Park"
Shipping Line 4: "Sydney NSW 2000"
Shipping Line 5: "Australia"
Result: "123 Main Street\r\nUnit 5\r