DROP TABLE IF EXISTS `plugin_stripe`;
CREATE TABLE IF NOT EXISTS `plugin_stripe` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `reference_id` varchar(255) DEFAULT NULL,
  `session_id` varchar(255) DEFAULT NULL,
  `txn_id` varchar(255) DEFAULT NULL,
  `amount` decimal(9,2) unsigned DEFAULT NULL,
  `currency` varchar(3) DEFAULT NULL,
  `payer_email` varchar(255) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `session_id` (`session_id`),
  KEY `reference_id` (`reference_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_menu_transactions', 'backend', 'Stripe plugin / Menu Stripe', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Stripe', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Stripe', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Stripe', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_config', 'backend', 'Stripe plugin / Stripe config', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Stripe configuration', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Stripe configuration', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Stripe configuration', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_created', 'backend', 'Stripe plugin / Date & Time', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Date/Time', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Date/Time', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Date/Time', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_reference_id', 'backend', 'Stripe plugin / Reference', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Reference', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Reference', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Reference', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_txn_id', 'backend', 'Stripe plugin / Txn ID', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Txn ID', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Txn ID', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Txn ID', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_amount', 'backend', 'Stripe plugin / Amount', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Amount', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Amount', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Amount', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_currency', 'backend', 'Stripe plugin / Currency', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Currency', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Currency', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Currency', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_status', 'backend', 'Stripe plugin / Status', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Status', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Status', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Status', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'plugin_stripe_redirecting', 'backend', 'Stripe plugin / Redirecting', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Redirecting to Stripe...', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Redirecting to Stripe...', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Redirecting to Stripe...', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'error_titles_ARRAY_PST01', 'arrays', 'Stripe plugin / Info title', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Stripe', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Stripe', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Stripe', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'error_bodies_ARRAY_PST01', 'arrays', 'Stripe plugin / Info body', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Enter your Stripe API keys below. Test keys start with pk_test_/sk_test_, live keys with pk_live_/sk_live_.', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Enter your Stripe API keys below. Test keys start with pk_test_/sk_test_, live keys with pk_live_/sk_live_.', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Enter your Stripe API keys below. Test keys start with pk_test_/sk_test_, live keys with pk_live_/sk_live_.', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'error_titles_ARRAY_PST02', 'arrays', 'Stripe plugin / Saved title', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'Stripe settings updated!', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'Stripe settings updated!', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'Stripe settings updated!', 'plugin');

INSERT INTO `fields` (`id`, `key`, `type`, `label`, `source`, `modified`) VALUES
(NULL, 'error_bodies_ARRAY_PST02', 'arrays', 'Stripe plugin / Saved body', 'plugin', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`) VALUES
(NULL, @id, 'pjField', 1, 'title', 'All changes have been saved.', 'plugin'),
(NULL, @id, 'pjField', 2, 'title', 'All changes have been saved.', 'plugin'),
(NULL, @id, 'pjField', 3, 'title', 'All changes have been saved.', 'plugin');
