It seems more logical to apply the discount to the whole 5500 though... the total amount which the debtor owed was 5500 (the invoice total) and the 2000 early deposit can be considered as a partial payment. The rest of the 3500 was then paid within the credit terms so the 2% discount would be applied to the whole 5500.
Discounts are applied to the total amount owed. The $2000 was never owed by the debtor - in fact, its quite the opposite in that the firm owes this value in stock to the debtor. Hence, the discount will only be applied to the $3500 (i.e. the credit sale).
Remember that prepaid sales and credit sales are different systems of selling stock. For the sake of understanding, just consider it as if the discount only applies to the credit sale portion of the transaction. Though, this is not in the definition.
Sorry if I am wrong. That is how my teacher has taught us to do it.