It is important to note that gift cards and coupons (discounts) have different uses, as well as different order data. Coupons are discounts, so they are directly deducted from the "sales amount," but gift cards are recorded as a payment method, so you need to be careful when calculating the discount amount later.
Gift cards are treated as paid amounts, Coupons (discounts) are recorded as the discount amount.