In case the customer visits merchant's shop via the affiliate link and use coupon code of the same affiliate, that affiliate will not get double commission. Instead, they will only get commission calculated basing on order amount after applying the coupon code.