Issue while using fulfillment and refund Rest API

We have an order with 4 line items

1st line item - 1 unit

2nd line item - 2 units

3rd line item - 3 units

4th line item - 4 units

We are using Rest API to partial fulfill the items , with fulfillment of 1 unit from each line item.

curl --location 'https://hb-development-us.myshopify.com/admin/api/2024-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: XXXXXXXXX' \
--data '{
    "fulfillment": {
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": 6898743148772,
                "fulfillment_order_line_items": [
                    {
                        "id": 14439521419492,
                        "quantity": 1
                    },
                    {
                        "id": 14439521452260,
                        "quantity": 1
                    },
                    {
                        "id": 14439521485028,
                        "quantity": 1
                    },
                    {
                        "id": 14439521517796,
                        "quantity": 1
                    }
                ]
            }
        ],
        "notify_customer": true,
        "tracking_info": {
            "number": "t34636"
        }
    }
}'

Fulfillment status after execution of above API.

{
    "fulfillment_orders": [
        {
            "id": 6898743148772,
            "created_at": "2024-08-23T05:08:55-07:00",
            "updated_at": "2024-08-26T06:25:52-07:00",
            "shop_id": 62836375780,
            "order_id": 5797466374372,
            "assigned_location_id": 67801776356,
            "request_status": "unsubmitted",
            "status": "in_progress",
            "fulfill_at": "2024-08-23T05:00:00-07:00",
            "supported_actions": [
                "create_fulfillment",
                "hold",
                "split"
            ],
            "destination": {
                "id": 6368326615268,
                "address1": "815 2nd Avenue",
                "address2": null,
                "city": "Goose Creek",
                "company": null,
                "country": "United States",
                "email": "mackenzie.morgan@playboycontractors.com",
                "first_name": "Mackenzie",
                "last_name": "Morgan",
                "phone": "(703) 638-0708",
                "province": "South Carolina",
                "zip": "29486"
            },
            "line_items": [
                {
                    "id": 14439521419492,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 1,
                    "line_item_id": 14200209309924,
                    "inventory_item_id": 45030641336548,
                    "fulfillable_quantity": 0,
                    "variant_id": 42935597498596
                },
                {
                    "id": 14439521452260,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 2,
                    "line_item_id": 14200209342692,
                    "inventory_item_id": 45030767362276,
                    "fulfillable_quantity": 1,
                    "variant_id": 42935723524324
                },
                {
                    "id": 14439521485028,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 3,
                    "line_item_id": 14200209375460,
                    "inventory_item_id": 45031821181156,
                    "fulfillable_quantity": 2,
                    "variant_id": 42936777343204
                },
                {
                    "id": 14439521517796,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 4,
                    "line_item_id": 14200209408228,
                    "inventory_item_id": 45030857703652,
                    "fulfillable_quantity": 3,
                    "variant_id": 42935813865700
                }
            ],
            "international_duties": null,
            "fulfillment_holds": [],
            "fulfill_by": null,
            "delivery_method": {
                "id": 996526162148,
                "method_type": "shipping",
                "min_delivery_date_time": null,
                "max_delivery_date_time": null
            },
            "assigned_location": {
                "address1": "6750 West Van Buren Street",
                "address2": "Suite 150",
                "city": "Phoenix",
                "country_code": "US",
                "location_id": 67801776356,
                "name": "6750 West Van Buren Street",
                "phone": null,
                "province": "Arizona",
                "zip": "85043"
            },
            "merchant_requests": []
        }
    ]
}

After this step, when we try to cancel & refund 2nd line item with quantity 1 , we do not see the item is removed from unfulfillment list

curl --location 'https://hb-development-us.myshopify.com/admin/api/2024-01/orders/5797466374372/refunds.json' \
--header 'X-Shopify-Access-Token: xxxxxx' \
--data '{
    "refund": {
        "currency": "USD",
        "order_id": "5797466374372",
        "refund_line_items": [
            {
                "line_item_id": "14200209342692",
                "quantity": 1,
                "restockType": "NO_RESTOCK"
            }
        ],
        "transactions": [
            {
                "order_id": "5797466374372",
                "gateway": "shopify_payments",
                "kind": "refund",
                "parent_id": "6844163981540",
                "amount": 85
            }
        ],
        "notify": true,
        "note": "Allitemsandqtynotavailablejustconsolidated"
    }
}'

After the execution of above API , we have the fulfillment status as below for 2nd line item,

curl --location 'https://hb-development-us.myshopify.com/admin/api/2024-01/orders/5797466374372/fulfillment_orders.json' \
--header 'X-Shopify-Access-Token: xxxxxx'

-----------------------------Response -------------------
{
    "fulfillment_orders": [
        {
            "id": 6898743148772,
            "created_at": "2024-08-23T05:08:55-07:00",
            "updated_at": "2024-08-26T06:25:52-07:00",
            "shop_id": 62836375780,
            "order_id": 5797466374372,
            "assigned_location_id": 67801776356,
            "request_status": "unsubmitted",
            "status": "in_progress",
            "fulfill_at": "2024-08-23T05:00:00-07:00",
            "supported_actions": [
                "create_fulfillment",
                "hold",
                "split"
            ],
            "destination": {
                "id": 6368326615268,
                "address1": "815 2nd Avenue",
                "address2": null,
                "city": "Goose Creek",
                "company": null,
                "country": "United States",
                "email": "mackenzie.morgan@playboycontractors.com",
                "first_name": "Mackenzie",
                "last_name": "Morgan",
                "phone": "(703) 638-0708",
                "province": "South Carolina",
                "zip": "29486"
            },
            "line_items": [
                {
                    "id": 14439521419492,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 1,
                    "line_item_id": 14200209309924,
                    "inventory_item_id": 45030641336548,
                    "fulfillable_quantity": 0,
                    "variant_id": 42935597498596
                },
                {
                    "id": 14439521452260,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 2,
                    "line_item_id": 14200209342692,
                    "inventory_item_id": 45030767362276,
                    "fulfillable_quantity": 1,
                    "variant_id": 42935723524324
                },
                {
                    "id": 14439521485028,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 3,
                    "line_item_id": 14200209375460,
                    "inventory_item_id": 45031821181156,
                    "fulfillable_quantity": 2,
                    "variant_id": 42936777343204
                },
                {
                    "id": 14439521517796,
                    "shop_id": 62836375780,
                    "fulfillment_order_id": 6898743148772,
                    "quantity": 4,
                    "line_item_id": 14200209408228,
                    "inventory_item_id": 45030857703652,
                    "fulfillable_quantity": 3,
                    "variant_id": 42935813865700
                }
            ],
            "international_duties": null,
            "fulfillment_holds": [],
            "fulfill_by": null,
            "delivery_method": {
                "id": 996526162148,
                "method_type": "shipping",
                "min_delivery_date_time": null,
                "max_delivery_date_time": null
            },
            "assigned_location": {
                "address1": "6750 West Van Buren Street",
                "address2": "Suite 150",
                "city": "Phoenix",
                "country_code": "US",
                "location_id": 67801776356,
                "name": "6750 West Van Buren Street",
                "phone": null,
                "province": "Arizona",
                "zip": "85043"
            },
            "merchant_requests": []
        }
    ]
}

And on Shopify Admin screen we are seeing 1 unfulfilled item on 2nd line item.

Same results are there when we try to cancel and refund all items from line 3 and line 4 , we are able to see 1 unfulfilled item in each line 3 and line 4.

Please let me know if I am missing anything. Let me know if you need any additional details.

Thanks