Fixed coupon flag bug & delivery coupon insertion

Fixed bug which used to unset used flag of coupon code, after delivering
item. Also updated IP address acquiring technique. Added coupon code
insertion to delivery table.