-- Create Table Statement for 'Email Transaction'
DROP TABLE IF EXISTS `EMAIL_TRANSACTION`;
CREATE TABLE `EMAIL_TRANSACTION` (
	ID bigint(20) NOT NULL,
	MERCHANT_ACCOUNT_CODE int(11) NOT NULL,
	CREATE_DATE datetime,
	TEMPLATE_CODE varchar,
	EXTERNAL_REFERENCE_CODE bigint(20),
	FROM_EMAIL varchar,
	CC_EMAIL varchar,
	TO_EMAIL varchar,
	SUBJECT varchar,
	MESSAGE varchar,
	IS_PLAIN_MESSAGE tinyint(1),
	ATTACHMENT_CODE bigint(20),
	ATTACHMENT_CONTENT_SOURCE_CL varchar,
	FILE_EXTENTION varchar,
	FIRST_NAME varchar,
	LAST_NAME varchar,
	BILLING_STREET1 varchar,
	BILLING_STREET2 varchar,
	BILLING_CITY varchar,
	BILLING_STATE varchar,
	BILLING_ZIP_CODE varchar,
	BILLING_COUNTRY_CODE varchar,
	SHIPPING_STREET1 varchar,
	SHIPPING_STREET2 varchar,
	SHIPPING_CITY varchar,
	SHIPPING_STATE varchar,
	SHIPPING_ZIP_CODE varchar,
	SHIPPING_COUNTRY_CODE varchar,
	CUSTOMER_ACCOUNT_CODE varchar,
	CUSTOMER_ACCOUNT_BALANCE int(11),
	CUSTOMER_ACCOUNT_NOTES varchar,
	MERCHANT_NAME varchar,
	MERCHANT_ACCOUNT_NAME varchar,
	TRANSACTION_CODE varchar,
	TRANSACTION_TYPE varchar,
	TRANSACTION_AMOUNT int(11),
	TRANSACTION_BALANCE int(11),
	TRANSACTION_DATE datetime,
	TRANSACTION_DUE_DATE datetime,
	NOTE varchar,
	RESPONSE_CODE varchar,
	RETURN_REASON varchar,
	RETURN_FEE_AMOUNT int(11),
	LATE_FEE_AMOUNT int(11),
	PAYMENT_PLAN_CODE varchar,
	PAYMENT_PLAN_AMOUNT int(11),
	PAYMENT_PLAN_ITEM_DESCRIPTION varchar,
	FIRST_BILLING_DATE datetime,
	NEXT_BILLING_DATE datetime,
	PAYMENT_OPTION_HOLDER_NAME varchar,
	PAYMENT_OPTION_TYPE varchar,
	PAYMENT_OPTION_NUMBER varchar,
	BALANCE_PHASE1 int(11),
	BALANCE_PHASE2 int(11),
	BALANCE_PHASE3 int(11),
	BALANCE_PHASE4 int(11),
	RESPONSE varchar,
	BCC_EMAIL varchar,
	RETAIL_TRANSACTION_CYCLE_FK bigint(20),
	TERMINAL_ORDER_FK bigint(20),
	MESSAGE varchar,
	MESSAGE varchar,
	REPLY_TO_EMAIL varchar,
	REPLY_TO_EMAIL varchar,
	REPLY_TO_EMAIL varchar,
	PRIMARY KEY (ID)
) ENGINE=InnoDB;