-- This script also sets Outbound Email preferences to SMTP, localhost, port 25
-- This script should be run after sample data is loaded (civicrm_generated.mysql).
-INSERT INTO `civicrm_payment_processor` (`id`, `name`, `description`, `payment_processor_type`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (3, 'PP Pro', '', 'PayPal', 1, 1, 0, 'xxx', 'yyy', 'zzz', 'https://www.paypal.com/', 'https://api-3t.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
-INSERT INTO `civicrm_payment_processor` (`id`, `name`, `description`, `payment_processor_type`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (4, 'PP Pro', '', 'PayPal', 1, 0, 1, 'dave_api1.northtower.com', 'S5YW42RS7WRWT9AD', 'AUsrQDMAfRs6zQSEYuw3M4QDuTBHAAvpXf7N0jYi8G1UCfKRI2NrvWVM', 'https://www.sandbox.paypal.com/', 'https://api-3t.sandbox.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
+SELECT @ppTypeID := id FROM civicrm_payment_processor_type WHERE name = 'PayPal';
+
+INSERT INTO `civicrm_payment_processor` (`id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (3, 'PP Pro', '', @ppTypeID, 1, 1, 0, 'xxx', 'yyy', 'zzz', 'https://www.paypal.com/', 'https://api-3t.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`id`, `name`, `description`, `payment_processor_type`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (4, 'PP Pro', '', @ppTypeID, 1, 0, 1, 'dave_api1.northtower.com', 'S5YW42RS7WRWT9AD', 'AUsrQDMAfRs6zQSEYuw3M4QDuTBHAAvpXf7N0jYi8G1UCfKRI2NrvWVM', 'https://www.sandbox.paypal.com/', 'https://api-3t.sandbox.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
+
+SET @pp := LAST_INSERT_ID();
UPDATE `civicrm_contribution_page`
-SET payment_processor = 3;
+SET payment_processor = @pp;
UPDATE `civicrm_event`
-SET payment_processor = 3;
-
--- This is currently being done in civicrm_generated.mysql. dgg
--- UPDATE `civicrm_preferences`
--- SET mailing_backend = 'a:9:{s:5:"qfKey";s:32:"a448a3899c4adc89341b7e3c81b70e96";s:15:"outBound_option";s:1:"0";s:13:"sendmail_path";s:17:"/usr/bin/sendmail";s:13:"sendmail_args";s:2:"-i";s:10:"smtpServer";s:9:"localhost";s:8:"smtpPort";s:2:"25";s:8:"smtpAuth";s:1:"0";s:12:"smtpUsername";s:0:"";s:12:"smtpPassword";s:0:"";}';
+SET payment_processor = @pp;