-- Create Table Statement for 'Merchant'
DROP TABLE IF EXISTS `IAPP_MERCHANT`;
CREATE TABLE `IAPP_MERCHANT` (
	CODE int(11) NOT NULL,
	REF_CODE varchar,
	NAME varchar,
	CREATE_DATE datetime,
	IS_ACTIVE tinyint(1),
	NOTES varchar,
	PROCESSING_SERVER varchar,
	PROCESSING_PASSWORD varchar NOT NULL,
	IBILLING_FORECASTING_PERIOD int(11),
	CONTACT_NAME varchar,
	STREET1 varchar,
	STREET2 varchar,
	CITY varchar,
	STATE varchar,
	ZIP_CODE varchar,
	PHONE varchar,
	FAX varchar,
	EMAIL varchar,
	MERCHANT_CL varchar,
	MERCHANT_NATURE_CL varchar,
	CONFIRM_EMAILS tinyint(1),
	IS_UPDATE_ROUTING_NUMBERS tinyint(1),
	STATEMENT_STREET1 varchar,
	STATEMENT_STREET2 varchar,
	STATEMENT_CITY varchar,
	STATEMENT_STATE varchar,
	STATEMENT_ZIP_CODE varchar,
	STATEMENT_PHONE varchar,
	STATEMENT_EMAIL varchar,
	STATEMENT_MAIL_NAME varchar,
	STATEMENT_HEADER_MESSAGE varchar,
	STATEMENT_FOOTER_MESSAGE varchar,
	CC_CHARGE_FEE int(11),
	CC_CHARGE_SHARE int(11),
	CC_RETURN_FEE int(11),
	CC_CREDIT_FEE int(11),
	CC_CHARGEBACK_FEE int(11),
	EFT_CHARGE_FEE int(11),
	EFT_CHARGE_SHARE int(11),
	EFT_RETURN_FEE int(11),
	EFT_CREDIT_FEE int(11),
	LETTER_FEE int(11),
	EMAIL_FEE int(11),
	CALL_FEE int(11),
	COLLECTIONS1ST_FEE int(11),
	COLLECTIONS1ST_SHARE int(11),
	COLLECTIONS3RD_FEE int(11),
	COLLECTIONS3RD_SHARE int(11),
	DECLINE_LIMIT int(11),
	DOCUMENT_ACCESS_FEE int(11),
	DOCUMENT_ACCESS_INTERVAL int(11),
	CUSTOMER_SOFT_DECLINE_FEE int(11),
	CUSTOMER_HARD_DECLINE_FEE int(11),
	CUSTOMER_CHARGEBACK_FEE int(11),
	CUSTOMER_FREEZE_FEE int(11),
	CUSTOMER_LATE_FEE int(11),
	CUSTOMER_LATE_PERIOD int(11),
	LETTER_CODE_WELCOME varchar,
	LETTER_CODE_SOFT_DECLINE varchar,
	LETTER_CODE_HARD_DECLINE varchar,
	LETTER_CODE_CHARGEBACK varchar,
	LETTER_CODE_STATEMENT varchar,
	COLLECTIONS_LETTER_CODE1 varchar,
	COLLECTIONS_LETTER_CODE2 varchar,
	COLLECTIONS_LETTER_CODE3 varchar,
	COLLECTIONS_LETTER_CODE4 varchar,
	COLLECTIONS_LETTER_CODE5 varchar,
	COLLECTIONS_LETTER_AGE1 int(11),
	COLLECTIONS_LETTER_AGE2 int(11),
	COLLECTIONS_LETTER_AGE3 int(11),
	COLLECTIONS_LETTER_AGE4 int(11),
	COLLECTIONS_LETTER_AGE5 int(11),
	COLLECTIONS_PERIOD int(11),
	COLLECTIONS_FEE int(11),
	COLLECTIONS_SHARE decimal(10,2),
	NOTIFICATION_LETTER_CODE varchar,
	NOTIFICATION_LETTER_PERIOD int(11),
	IS_DISALLOW_MULTIPLE_PAYMENT_PLANS tinyint(1),
	RESOURCE_BUNDLE varchar,
	SKIP_TRACE_PERIOD int(11),
	NOTIFICATION_LETTER_CODE1 varchar,
	NOTIFICATION_LETTER_CODE2 varchar,
	NOTIFICATION_LETTER_CODE3 varchar,
	NOTIFICATION_LETTER_AGE1 int(11),
	NOTIFICATION_LETTER_AGE2 int(11),
	NOTIFICATION_LETTER_AGE3 int(11),
	IS_LETTER_CODE_SOFT_DECLINE_STATEMENT tinyint(1),
	IS_LETTER_CODE_HARD_DECLINE_STATEMENT tinyint(1),
	IS_LETTER_CODE_CHARGEBACK_STATEMENT tinyint(1),
	PHASE2_AGE int(11),
	PHASE3_AGE int(11),
	PHASE4_AGE int(11),
	PORTAL_DOCUMENT_UPLOAD_LIMIT int(11),
	PORTAL_DOCUMENT_MAX_FILE_SIZE int(11),
	CUSTOMER_SERVICE_NUMBER varchar,
	CUSTOMER_SERVICE_FAX varchar,
	CUSTOMER_SERVICE_STREET varchar,
	CUSTOMER_SERVICE_CITY varchar,
	CUSTOMER_SERVICE_STATE varchar,
	CUSTOMER_SERVICE_ZIP_CODE varchar,
	CUSTOMER_SERVICE_WORKING_HOURS varchar,
	IS_LATE_FEE_APPLIED_IN_COLLECTIONS tinyint(1),
	PRINCIPAL_AGENT_COMMISSION_SHARE decimal(10,2),
	LATE_FEE_AGENT_COMMISSION_SHARE decimal(10,2),
	RETURN_FEE_AGENT_COMMISSION_SHARE decimal(10,2),
	CREDIT_CARD_AGENT_COMMISSION_FEE int(11),
	BANK_ACCOUNT_AGENT_COMMISSION_FEE int(11),
	AGENT_COMMISSION_AGE int(11),
	EMAIL_CODE_WELCOME varchar,
	EMAIL_CODE_SOFT_DECLINE varchar,
	EMAIL_CODE_HARD_DECLINE varchar,
	EMAIL_CODE_CHARGEBACK varchar,
	EMAIL_CODE_STATEMENT varchar,
	EMAIL_CODE_INVOICE_NOTIFICATION varchar,
	EMAIL_INVOICE_NOTIFICATION_PERIOD int(11),
	NOTIFICATION_EMAIL_CODE1 varchar,
	NOTIFICATION_EMAIL_CODE2 varchar,
	NOTIFICATION_EMAIL_CODE3 varchar,
	NOTIFICATION_EMAIL_AGE1 int(11),
	NOTIFICATION_EMAIL_AGE2 int(11),
	NOTIFICATION_EMAIL_AGE3 int(11),
	COLLECTIONS_EMAIL_CODE1 varchar,
	COLLECTIONS_EMAIL_CODE2 varchar,
	COLLECTIONS_EMAIL_CODE3 varchar,
	COLLECTIONS_EMAIL_CODE4 varchar,
	COLLECTIONS_EMAIL_CODE5 varchar,
	COLLECTIONS_EMAIL_AGE1 int(11),
	COLLECTIONS_EMAIL_AGE2 int(11),
	COLLECTIONS_EMAIL_AGE3 int(11),
	COLLECTIONS_EMAIL_AGE4 int(11),
	COLLECTIONS_EMAIL_AGE5 int(11),
	EMAIL_CODE_AGENT_PAYMENT varchar,
	EMAIL_CODE_PORTAL_PAYMENT varchar,
	EMAIL_CODE_DRAFT_PAYMENT varchar,
	EMAIL_CODE_INVOICE varchar,
	EMAIL_CODE_CREDIT varchar,
	EMAIL_CODE_CANCEL_CREDIT varchar,
	EMAIL_CODE_LATE_FEE varchar,
	EMAIL_CODE_REFUND varchar,
	EMAIL_CODE_CANCEL_REFUND varchar,
	EMAIL_CODE_VOID varchar,
	SOFT_DECLINE_WAIT_PERIOD_LETTER int(11),
	SOFT_DECLINE_WAIT_PERIOD_EMAIL int(11),
	IS_REQUIRED_BALANCE_SOFT_DECLINE_LETTER tinyint(1),
	IS_REQUIRED_BALANCE_SOFT_DECLINE_EMAIL tinyint(1),
	IS_KEEP_BAD_PHONES tinyint(1),
	TERMINAL_CUSTOMER_ACCOUNT_AGE int(11),
	TERMINAL_INVOICE_AGE int(11),
	CREDIT_AGENCY_STATUS_CL varchar,
	MIN_CREDIT_REPORTING_BALANCE int(11),
	NON_CREDIT_REPORTING_STATE_LIST varchar,
	CUSTOMER_LEVEL_CL varchar,
	IS_PROCESS_SCHEDULED_PAYMENT_DECLINE tinyint(1),
	IS_REVERSE_CHARGEBACK_FEE tinyint(1),
	IS_BATCH_REVIEW_REQUIRED tinyint(1),
	RETURNS_CALLBACK_URL varchar,
	SUBMISSIONS_CALLBACK_URL varchar,
	IS_TOKENIZATION_ENABLED tinyint(1),
	ACCOUNT_UPDATER_PERIOD int(11),
	IS_MERCHANT_STATEMENT_REVIEW_REQUIRED tinyint(1),
	IS_RESELLER_STATEMENT_REVIEW_REQUIRED tinyint(1),
	MERCHANT_CONFIGURATOR varchar,
	ACH_REMITTANCE_PERIOD int(11),
	CC_REMITTANCE_PERIOD int(11),
	AMEX_REMITTANCE_PERIOD int(11),
	PROCESSING_CUTOFF int(11),
	REMITTANCE_PERIOD int(11),
	IS_ACCUMULATE_RETURNS tinyint(1),
	PARENT_MERCHANT_CODE int(11),
	ACCOUNT_BALANCE_ALGORITHM_CL varchar,
	TAX_ID_CODE varchar,
	TIME_ZONE_CODE varchar,
	IS_PAYMENT_OPTION_DISABLED_ON_DECLINE tinyint(1),
	REMITTANCE_MODE_CL varchar,
	PORTAL_WELCOME_PAGE_FK int(11),
	COLLECTOR_FK int(11),
	REMITTER_FK int(11),
	MERCHANT_ACCOUNT_GROUP_FK bigint(20),
	MERCHANT_ACTIVITY_FK bigint(20),
	REMITTANCE_BASIS_CL varchar,
	MAIL_MODE_CL varchar,
	IS_SKIP_TRACE_ENABLED tinyint(1),
	IS_EXPIRATION_DATE_VALIDATION_ENABLED tinyint(1),
	IS_ROUTING_NUMBER_VALIDATION_ENABLED tinyint(1),
	BATCH_VALIDATION_THRESHOLD_COUNT int(11),
	BATCH_VALIDATION_THRESHOLD_AMOUNT int(11),
	CODE_UNIQUENESS_SCOPE_CL varchar,
	BUSINESS_INFO_FK bigint(20),
	DEFAULT_USER_FK int(11),
	COUNTRY_CODE varchar,
	AVS_RESPONSE_MASK int(11),
	CSC_RESPONSE_MASK int(11),
	CUSTOMER_STATEMENT_FEE int(11),
	RETURNS_DELIVERY_MODE_CL varchar,
	NON_COLLECTIONS_FEE_STATE_LIST varchar,
	RESELLER_FK int(11),
	IS_BATCH_CUSTOM_FIELD_ENABLED tinyint(1),
	RETRY_FEE int(11),
	CUSTOMER_RETURN_FEE int(11),
	CUSTOMER_AGENT_PAYMENT_CONVENIENCE_FEE int(11),
	CUSTOMER_PORTAL_PAYMENT_CONVENIENCE_FEE int(11),
	CLIENT_FEE_FK bigint(20),
	IDENTITIES varchar,
	MERCHANT_PROFILE varchar,
	PORTFOLIO_FK int(11),
	IS_TRANSACTION_PROCESSING_OPTIMIZATION_ENABLED tinyint(1),
	IS_ACCOUNT_AGGREGATION_ACH_ENABLED tinyint(1),
	IS_ACCOUNT_AGGREGATION_CARDS_ENABLED tinyint(1),
	IS_LETTER_INVOICE_NOTIFICATION_INVOICE_ONLY tinyint(1),
	IS_EMAIL_INVOICE_NOTIFICATION_INVOICE_ONLY tinyint(1),
	LATE_CUSTOMER_FEE_FK bigint(20),
	SOFT_DECLINE_CUSTOMER_FEE_FK bigint(20),
	HARD_DECLINE_CUSTOMER_FEE_FK bigint(20),
	CHARGEBACK_CUSTOMER_FEE_FK bigint(20),
	RETURN_CUSTOMER_FEE_FK bigint(20),
	FREEZE_RECURRING_CUSTOMER_FEE_FK bigint(20),
	FREEZE_FLAT_CUSTOMER_FEE_FK bigint(20),
	RETRY_CUSTOMER_FEE_FK bigint(20),
	DEACTIVATE_DATE datetime,
	IS_IMPORT_LOG_REVIEW_REQUIRED tinyint(1),
	MINIMUM_PERPETUAL_BILLING_COUNT int(11),
	ENROLLMENT_FEE_FK bigint(20),
	TIME_ZONE_SYSTEM_CODE varchar,
	IS_REALTIME_REVIEW_REQUIRED tinyint(1),
	RESELLER_ENTITY_CODE int(11),
	IS_FILE_HASH_VALIDATION_ENABLED tinyint(1),
	BLACKLIST_POLICY_CL varchar,
	RETURNS_GENERATION_TIME int(11),
	TOKENIZATION_FORMAT_CL varchar,
	STATEMENT_CUSTOMER_FEE_FK bigint(20),
	DATA_EXPORT_POLICY varchar,
	CHANNEL_FK bigint(20),
	BATCH_PROCESSING_POLICY_CL varchar,
	BATCH_ACCOUNT_UPDATE_POLICY_CL varchar,
	DEPOSIT_GROUPING_CL varchar,
	OFFLINE_CALL_BACK_URL varchar,
	ADDITIONAL_PASSWORD varchar,
	EMAIL_CODE_ACCOUNT_EXPIRATION varchar,
	EMAIL_CODE_ACCOUNT_EXPIRATION_PERIOD int(11),
	FEE_PROCESSOR_FK int(11),
	TOKENIZATION_UPDATE_POLICY_CL varchar,
	FILE_ENCRYPTION_PUBLIC_KEY_FILE_NAME varchar,
	MERCHANT_ACCOUNT_FK int(11),
	TOKENIZATION_REMOVAL_CL varchar,
	DIRECTORY_CODE varchar,
	TAG_LIST varchar,
	IS_MULTIPLE_RETURNS_FILE_SUPPORTED tinyint(1),
	IS_MULTIPLE_RETURNS_FILE_SUPPORTED tinyint(1),
	REMITTANCE_PERIOD int(11),
	ACH_REMITTANCE_PERIOD int(11),
	CC_REMITTANCE_PERIOD int(11),
	AMEX_REMITTANCE_PERIOD int(11),
	IS_MULTIPLE_RETURNS_FILE_SUPPORTED tinyint(1),
	AGGREGATION_LEVEL_CL varchar,
	REMITTANCE_PERIOD int(11),
	ACH_REMITTANCE_PERIOD int(11),
	CC_REMITTANCE_PERIOD int(11),
	AMEX_REMITTANCE_PERIOD int(11),
	AGGREGATION_LEVEL_CL varchar,
	TAG_LIST varchar,
	IS_TOKENIZATION_ENABLED tinyint(1),
	SCRIPT_REGISTRY_CODE bigint(20),
	IS_TOKENIZATION_ENABLED tinyint(1),
	SCRIPT_REGISTRY_CODE bigint(20),
	NEXT_ACCOUNT_ID int(11),
	SCRIPT_REGISTRY_CODE bigint(20),
	AGGREGATION_LEVEL_CL varchar,
	TAG_LIST varchar,
	COLLECTIONS_SHARE decimal(10,2),
	PRINCIPAL_AGENT_COMMISSION_SHARE decimal(10,2),
	LATE_FEE_AGENT_COMMISSION_SHARE decimal(10,2),
	RETURN_FEE_AGENT_COMMISSION_SHARE decimal(10,2),
	COLLECTIONS_SHARE decimal(10,2),
	PRINCIPAL_AGENT_COMMISSION_SHARE decimal(10,2),
	LATE_FEE_AGENT_COMMISSION_SHARE decimal(10,2),
	RETURN_FEE_AGENT_COMMISSION_SHARE decimal(10,2),
	NEXT_ACCOUNT_ID int(11),
	IS_MULTIPLE_REMITTANCE tinyint(1),
	IS_MULTIPLE_REMITTANCE tinyint(1),
	IS_MULTIPLE_ACCOUNTS tinyint(1),
	IS_MULTIPLE_TAX_IDS tinyint(1),
	IS_MULTIPLE_DESCRIPTORS tinyint(1),
	IS_MULTIPLE_RECURRING_FEES tinyint(1),
	REMITTANCE_MODE_CL varchar,
	REMITTANCE_BASIS_CL varchar,
	REMITTANCE_MODE_CL varchar,
	REMITTANCE_BASIS_CL varchar,
	NEXT_ACCOUNT_ID int(11),
	IS_MULTIPLE_REMITTANCE tinyint(1),
	IS_MULTIPLE_ACCOUNTS tinyint(1),
	IS_MULTIPLE_TAX_IDS tinyint(1),
	IS_MULTIPLE_DESCRIPTORS tinyint(1),
	IS_MULTIPLE_RECURRING_FEES tinyint(1),
	CONTACT_NAME varchar,
	CONTACT_NAME varchar,
	IS_IMPORT_LOG_REVIEW_REQUIRED tinyint(1),
	DEPOSIT_GROUPING_CL varchar,
	DEPOSIT_GROUPING_CL varchar,
	DEPOSIT_GROUPING_CL varchar,
	IS_IMPORT_LOG_REVIEW_REQUIRED tinyint(1),
	IS_IMPORT_LOG_REVIEW_REQUIRED tinyint(1),
	NAME varchar,
	IS_MULTIPLE_ACCOUNTS tinyint(1),
	IS_MULTIPLE_TAX_IDS tinyint(1),
	IS_MULTIPLE_DESCRIPTORS tinyint(1),
	IS_MULTIPLE_RECURRING_FEES tinyint(1),
	PROCESSING_PASSWORD varchar NOT NULL,
	PHONE varchar,
	FAX varchar,
	STATEMENT_MAIL_NAME varchar,
	LETTER_CODE_WELCOME varchar,
	LETTER_CODE_SOFT_DECLINE varchar,
	LETTER_CODE_HARD_DECLINE varchar,
	LETTER_CODE_CHARGEBACK varchar,
	LETTER_CODE_STATEMENT varchar,
	COLLECTIONS_LETTER_CODE1 varchar,
	COLLECTIONS_LETTER_CODE2 varchar,
	COLLECTIONS_LETTER_CODE3 varchar,
	COLLECTIONS_LETTER_CODE4 varchar,
	COLLECTIONS_LETTER_CODE5 varchar,
	NOTIFICATION_LETTER_CODE varchar,
	NOTIFICATION_LETTER_CODE1 varchar,
	NOTIFICATION_LETTER_CODE2 varchar,
	NOTIFICATION_LETTER_CODE3 varchar,
	CUSTOMER_SERVICE_NUMBER varchar,
	CUSTOMER_SERVICE_FAX varchar,
	CUSTOMER_SERVICE_STREET varchar,
	CUSTOMER_SERVICE_CITY varchar,
	CUSTOMER_SERVICE_ZIP_CODE varchar,
	EMAIL_CODE_WELCOME varchar,
	EMAIL_CODE_SOFT_DECLINE varchar,
	EMAIL_CODE_HARD_DECLINE varchar,
	EMAIL_CODE_CHARGEBACK varchar,
	EMAIL_CODE_STATEMENT varchar,
	EMAIL_CODE_INVOICE_NOTIFICATION varchar,
	NOTIFICATION_EMAIL_CODE1 varchar,
	NOTIFICATION_EMAIL_CODE2 varchar,
	NOTIFICATION_EMAIL_CODE3 varchar,
	NOTIFICATION_EMAIL_AGE1 int(11),
	NOTIFICATION_EMAIL_AGE2 int(11),
	COLLECTIONS_EMAIL_CODE5 varchar,
	COLLECTIONS_EMAIL_CODE1 varchar,
	COLLECTIONS_EMAIL_CODE2 varchar,
	COLLECTIONS_EMAIL_CODE3 varchar,
	COLLECTIONS_EMAIL_CODE4 varchar,
	EMAIL_CODE_AGENT_PAYMENT varchar,
	EMAIL_CODE_PORTAL_PAYMENT varchar,
	EMAIL_CODE_DRAFT_PAYMENT varchar,
	EMAIL_CODE_CREDIT varchar,
	EMAIL_CODE_INVOICE varchar,
	EMAIL_CODE_CREDIT varchar,
	EMAIL_CODE_CANCEL_CREDIT varchar,
	EMAIL_CODE_LATE_FEE varchar,
	EMAIL_CODE_REFUND varchar,
	EMAIL_CODE_CANCEL_REFUND varchar,
	EMAIL_CODE_VOID varchar,
	PHONE varchar,
	FAX varchar,
	STATEMENT_MAIL_NAME varchar,
	LETTER_CODE_WELCOME varchar,
	LETTER_CODE_SOFT_DECLINE varchar,
	LETTER_CODE_HARD_DECLINE varchar,
	LETTER_CODE_CHARGEBACK varchar,
	LETTER_CODE_STATEMENT varchar,
	COLLECTIONS_LETTER_CODE1 varchar,
	COLLECTIONS_LETTER_CODE2 varchar,
	COLLECTIONS_LETTER_CODE3 varchar,
	COLLECTIONS_LETTER_CODE4 varchar,
	COLLECTIONS_LETTER_CODE5 varchar,
	NOTIFICATION_LETTER_CODE varchar,
	NOTIFICATION_LETTER_CODE1 varchar,
	NOTIFICATION_LETTER_CODE2 varchar,
	NOTIFICATION_LETTER_CODE3 varchar,
	CUSTOMER_SERVICE_NUMBER varchar,
	CUSTOMER_SERVICE_FAX varchar,
	CUSTOMER_SERVICE_STREET varchar,
	CUSTOMER_SERVICE_CITY varchar,
	CUSTOMER_SERVICE_ZIP_CODE varchar,
	EMAIL_CODE_WELCOME varchar,
	EMAIL_CODE_SOFT_DECLINE varchar,
	EMAIL_CODE_HARD_DECLINE varchar,
	EMAIL_CODE_CHARGEBACK varchar,
	EMAIL_CODE_STATEMENT varchar,
	EMAIL_CODE_INVOICE_NOTIFICATION varchar,
	NOTIFICATION_EMAIL_CODE1 varchar,
	NOTIFICATION_EMAIL_CODE2 varchar,
	NOTIFICATION_EMAIL_CODE3 varchar,
	NOTIFICATION_EMAIL_AGE1 int(11),
	NOTIFICATION_EMAIL_AGE2 int(11),
	COLLECTIONS_EMAIL_CODE5 varchar,
	COLLECTIONS_EMAIL_CODE1 varchar,
	COLLECTIONS_EMAIL_CODE2 varchar,
	COLLECTIONS_EMAIL_CODE3 varchar,
	COLLECTIONS_EMAIL_CODE4 varchar,
	EMAIL_CODE_AGENT_PAYMENT varchar,
	EMAIL_CODE_PORTAL_PAYMENT varchar,
	EMAIL_CODE_DRAFT_PAYMENT varchar,
	EMAIL_CODE_CREDIT varchar,
	EMAIL_CODE_INVOICE varchar,
	EMAIL_CODE_CREDIT varchar,
	EMAIL_CODE_CANCEL_CREDIT varchar,
	EMAIL_CODE_LATE_FEE varchar,
	EMAIL_CODE_REFUND varchar,
	EMAIL_CODE_CANCEL_REFUND varchar,
	EMAIL_CODE_VOID varchar,
	TEST_FIELD1 date,
	TEST_OBJECT1 date,
	TEST_OBJECT2 date,
	AGENT_FK int(11),
	PRIMARY KEY (CODE)
) ENGINE=InnoDB;