-- SGE Pay / Hi5pay Custom Payment Provider SQL Schema

CREATE TABLE IF NOT EXISTS `GHL_tokens` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `access_token` longtext DEFAULT NULL,
  `refresh_token` longtext DEFAULT NULL,
  `expires_in` varchar(255) DEFAULT NULL,
  `expires_time` varchar(255) DEFAULT NULL,
  `location_id` varchar(255) DEFAULT NULL,
  `company_id` varchar(255) DEFAULT NULL,
  `user_id` varchar(255) DEFAULT NULL,
  `user_type` varchar(255) DEFAULT NULL,
  `provider_integration_id` varchar(255) DEFAULT NULL,
  `sge_app_id` text DEFAULT NULL,
  `sge_secret_key` text DEFAULT NULL,
  `sge_mode` varchar(255) DEFAULT 'test',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `payments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) DEFAULT NULL,
  `publishableKey` text DEFAULT NULL,
  `amount` varchar(255) DEFAULT NULL,
  `currency` varchar(255) DEFAULT NULL,
  `mode` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `contact_name` varchar(255) DEFAULT NULL,
  `contact_email` varchar(255) DEFAULT NULL,
  `contact_country` varchar(255) DEFAULT NULL,
  `orderId` text DEFAULT NULL,
  `invoiceId` text DEFAULT NULL,
  `transactionId` text DEFAULT NULL,
  `locationId` text DEFAULT NULL,
  `status` varchar(255) DEFAULT 'pending',
  `gateway_order_no` text DEFAULT NULL,
  `gateway_trade_no` text DEFAULT NULL,
  `response` longtext DEFAULT NULL,
  `payment_status` varchar(255) DEFAULT 'pending',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
