
CREATE TABLE `sps_fastag_entries` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `txn_id` varchar(100) NOT NULL,
  `fastag_id` varchar(100) NOT NULL,
  `fastag_no` varchar(100) NOT NULL,
  `cron_status` int(10) DEFAULT 0,
  `tag_status` varchar(10) DEFAULT NULL,
  `vehicle_no` varchar(50) DEFAULT NULL,
  `exccode` varchar(50) DEFAULT NULL,
  `comvehicle` varchar(50) DEFAULT NULL,
  `used_for_payment` int(10) DEFAULT NULL,
  `tag_signature_data_hex` varchar(255) DEFAULT NULL,
  `tag_vrn` varchar(100) DEFAULT NULL,
  `issuer_bank_id` varchar(100) DEFAULT NULL,
  `tag_v_class` varchar(50) DEFAULT NULL,
  `rfu` varchar(50) DEFAULT NULL,
  `epc_id` varchar(100) DEFAULT NULL,
  `user_memory` text DEFAULT NULL,
  `tag_whitelist_status` varchar(20) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=DYNAMIC;

ALTER TABLE `sps_settings` ADD COLUMN `fastag_program` varchar(512) DEFAULT NULL AFTER `deleted_at`;

ALTER TABLE `sps_settings` ADD COLUMN `geo_location` varchar(255) DEFAULT NULL AFTER `fastag_program`;

ALTER TABLE `sps_transactions` ADD COLUMN `fastag_id` varchar(50)  DEFAULT NULL AFTER `notes`;

ALTER TABLE `sps_transactions` ADD COLUMN `exit_type` varchar(50) DEFAULT NULL AFTER `fastag_id`;

ALTER TABLE `sps_transactions` ADD COLUMN `entry_type` varchar(50) DEFAULT NULL AFTER `exit_type`;

ALTER TABLE `sps_transactions` ADD COLUMN `fastag_vehicle_no` varchar(50) DEFAULT NULL AFTER `entry_type`;


/* 15/05/2023 */

ALTER TABLE `sps_transactions` ADD COLUMN `fastag_pay` varchar(50) DEFAULT NULL COMMENT 'pending = ready for go fastag payment, cancel = transaction has been canceled by operator, detail should be on comment,\r\nsuccess = fastag payment success,\r\nfailure = fastag payment failed and detail is at comment' AFTER `entry_type`;

ALTER TABLE `sps_transactions` ADD COLUMN `fastag_comment` varchar(255) DEFAULT NULL AFTER `fastag_pay`;

ALTER TABLE `sps_transactions` ADD COLUMN `fastag_epc` varchar(255) DEFAULT NULL AFTER `fastag_pay`;

ALTER TABLE `sps_transactions` ADD COLUMN `fastag_tag_signature` varchar(255) DEFAULT NULL AFTER `fastag_pay`;
ALTER TABLE `sps_transactions` ADD COLUMN `fastag_messageId` varchar(100) DEFAULT NULL AFTER `fastag_pay`;



CREATE TABLE `sps_fastag_api_route_logs` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ip` varchar(200) DEFAULT NULL,
  `url` varchar(200) DEFAULT NULL,
  `method` varchar(200) DEFAULT NULL,
  `request_body` longtext DEFAULT NULL,
  `response` longtext DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;


INSERT INTO `sps_payment_modes`(`id`, `payment_mode`, `master_id`, `parent_id`, `location_id`, `area_id`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`, `payment_description`) VALUES (8, 'FASTag', 4, 8, 0, 0, 0, 0, '2023-01-23 10:21:50', NULL, NULL, NULL);


UPDATE `sps_settings` SET `fastag_program` = 'enabled', `geo_location` = '19.0619647,72.7694815';

ALTER TABLE `sps_gate_configurations` ADD COLUMN `fastag` tinyint(3) NULL DEFAULT NULL AFTER `deleted_at`;

