install.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. SET @sModuleName = 'bx_payflow';
  2. --
  3. -- Table structure for table `[db_prefix]providers`
  4. --
  5. CREATE TABLE IF NOT EXISTS `[db_prefix]providers` (
  6. `id` int(11) NOT NULL auto_increment,
  7. `name` varchar(64) NOT NULL default '',
  8. `caption` varchar(128) NOT NULL default '',
  9. `description` text NOT NULL default '',
  10. `option_prefix` varchar(32) NOT NULL default '',
  11. `for_visitor` tinyint(4) NOT NULL default '0',
  12. `class_name` varchar(128) NOT NULL default '',
  13. `class_file` varchar(255) NOT NULL default '',
  14. PRIMARY KEY(`id`)
  15. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  16. --
  17. -- Table structure for table `[db_prefix]providers_options`
  18. --
  19. CREATE TABLE IF NOT EXISTS `[db_prefix]providers_options` (
  20. `id` int(11) NOT NULL auto_increment,
  21. `provider_id` varchar(64) NOT NULL default '',
  22. `name` varchar(64) NOT NULL default '',
  23. `type` varchar(64) NOT NULL default 'text',
  24. `caption` varchar(255) NOT NULL default '',
  25. `description` text NOT NULL default '',
  26. `extra` varchar(255) NOT NULL default '',
  27. `check_type` varchar(64) NOT NULL default '',
  28. `check_params` varchar(128) NOT NULL default '',
  29. `check_error` varchar(128) NOT NULL default '',
  30. `order` tinyint(4) NOT NULL default '0',
  31. PRIMARY KEY(`id`),
  32. UNIQUE KEY `name`(`name`)
  33. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  34. --
  35. -- Table structure for table `[db_prefix]user_values`
  36. --
  37. CREATE TABLE IF NOT EXISTS `[db_prefix]user_values` (
  38. `user_id` int(11) NOT NULL default '0',
  39. `option_id` int(11) NOT NULL default '0',
  40. `value` varchar(255) NOT NULL default '',
  41. UNIQUE KEY `value`(`user_id`, `option_id`)
  42. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  43. --
  44. -- Table structure for table `[db_prefix]cart`
  45. --
  46. CREATE TABLE IF NOT EXISTS `[db_prefix]cart` (
  47. `client_id` int(11) NOT NULL default '0',
  48. `items` text NOT NULL default '',
  49. PRIMARY KEY(`client_id`)
  50. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  51. --
  52. -- Table structure for table `[db_prefix]transactions`
  53. --
  54. CREATE TABLE IF NOT EXISTS `[db_prefix]transactions` (
  55. `id` int(11) NOT NULL auto_increment,
  56. `pending_id` int(11) NOT NULL default '0',
  57. `order_id` varchar(16) NOT NULL default '',
  58. `client_id` int(11) NOT NULL default '0',
  59. `seller_id` int(11) NOT NULL default '0',
  60. `module_id` int(11) NOT NULL default '0',
  61. `item_id` int(11) NOT NULL default '0',
  62. `item_count` int(11) NOT NULL default '0',
  63. `amount` float NOT NULL default '0',
  64. `date` int(11) NOT NULL default '0',
  65. `reported` tinyint(4) NOT NULL default '0',
  66. PRIMARY KEY(`id`)
  67. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  68. --
  69. -- Table structure for table `[db_prefix]transactions_pending`
  70. --
  71. CREATE TABLE IF NOT EXISTS `[db_prefix]transactions_pending` (
  72. `id` int(10) unsigned NOT NULL auto_increment,
  73. `client_id` int(11) NOT NULL default '0',
  74. `seller_id` int(11) NOT NULL default '0',
  75. `items` text NOT NULL default '',
  76. `amount` float NOT NULL default '0',
  77. `order` varchar(32) NOT NULL default '',
  78. `order_ref` varchar(32) NOT NULL default '',
  79. `order_profile` varchar(32) NOT NULL default '',
  80. `error_code` varchar(16) NOT NULL default '',
  81. `error_msg` varchar(255) NOT NULL default '',
  82. `provider` varchar(32) NOT NULL default '',
  83. `date` int(11) NOT NULL default '0',
  84. `processed` tinyint(4) NOT NULL default '0',
  85. `reported` tinyint(4) NOT NULL default '0',
  86. PRIMARY KEY(`id`)
  87. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  88. --
  89. -- Table structure for table `[db_prefix]modules`
  90. --
  91. CREATE TABLE IF NOT EXISTS `[db_prefix]modules` (
  92. `id` int(11) NOT NULL auto_increment,
  93. `uri` varchar(64) NOT NULL default '',
  94. PRIMARY KEY(`id`),
  95. UNIQUE KEY `uri`(`uri`)
  96. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  97. -- options
  98. SET @iCategoryOrder = (SELECT MAX(`menu_order`) FROM `sys_options_cats`) + 1;
  99. INSERT INTO `sys_options_cats` (`name` , `menu_order` ) VALUES ('PayPal PayFlow Pro', @iCategoryOrder);
  100. SET @iCategoryId = LAST_INSERT_ID();
  101. INSERT INTO `sys_options` (`Name`, `VALUE`, `kateg`, `desc`, `Type`, `check`, `err_text`, `order_in_kateg`, `AvailableValues`) VALUES
  102. ('permalinks_module_payflow', 'on', 26, 'Enable friendly PayPal PayFlow Pro permalink', 'checkbox', '', '', 0, ''),
  103. ('bx_pfw_default_currency_code', 'USD', @iCategoryId, 'Currency code', 'select', 'return strlen($arg0) > 0;', 'Cannot be empty.', 1, 'AUD,CAD,EUR,GBP,USD,YEN'),
  104. ('bx_pfw_default_currency_sign', '$', @iCategoryId, 'Currency sign', 'digit', 'return strlen($arg0) > 0;', 'Cannot be empty.', 2, ''),
  105. ('bx_pfw_site_admin', '', @iCategoryId, 'Site administrator', 'select', '', '', 3, 'PHP:return BxDolService::call(''payment'', ''get_admins'');');
  106. -- permalinks
  107. INSERT INTO `sys_permalinks`(`standard`, `permalink`, `check`) VALUES
  108. ('modules/?r=payflow/', 'm/payflow/', 'permalinks_module_payflow');
  109. -- pages and blocks
  110. SET @iPCPOrder = (SELECT MAX(`Order`) FROM `sys_page_compose_pages`);
  111. INSERT INTO `sys_page_compose_pages`(`Name`, `Title`, `Order`) VALUES
  112. ('bx_pfw_cart', 'Payflow Shopping Cart', @iPCPOrder+1),
  113. ('bx_pfw_history', 'Payflow Cart History', @iPCPOrder+2),
  114. ('bx_pfw_orders', 'Payflow Order Administration', @iPCPOrder+3),
  115. ('bx_pfw_details', 'Payflow Payment Settings', @iPCPOrder+4);
  116. INSERT INTO `sys_page_compose` (`Page`, `PageWidth`, `Desc`, `Caption`, `Column`, `Order`, `Func`, `Content`, `DesignBox`, `ColWidth`, `Visible`, `MinWidth`) VALUES
  117. ('bx_pfw_cart', '1140px', 'Site Cart', '_bx_pfw_bcpt_cart_featured', 2, 0, 'Featured', '', 1, 50, 'memb', 0),
  118. ('bx_pfw_cart', '1140px', 'Members Cart', '_bx_pfw_bcpt_cart_common', 3, 0, 'Common', '', 1, 50, 'memb', 0),
  119. ('bx_pfw_history', '1140px', 'History', '_bx_pfw_bcpt_cart_history', 2, 0, 'History', '', 1, 100, 'memb', 0),
  120. ('bx_pfw_orders', '1140px', 'Orders', '_bx_pfw_bcpt_processed_orders', 2, 0, 'Orders', '', 1, 100, 'memb', 0),
  121. ('bx_pfw_details', '1140px', 'Payment Details', '_bx_pfw_bcpt_details', 2, 0, 'Details', '', 1, 100, 'memb', 0);
  122. -- menus
  123. SET @iOrder = (SELECT MAX(`order`) FROM `sys_menu_admin` WHERE `parent_id`='2');
  124. INSERT INTO `sys_menu_admin`(`parent_id`, `name`, `title`, `url`, `description`, `icon`, `icon_large`, `check`, `order`) VALUES
  125. (2, @sModuleName, '_bx_pfw_admin_menu_sitem', '{siteUrl}modules/?r=payflow/admin/', 'For managing PayPal PayFlow Pro', 'credit-card', '', '', @iOrder+1);
  126. -- alert
  127. INSERT INTO `sys_alerts_handlers`(`name`, `class`, `file`, `eval`) VALUES
  128. (@sModuleName, '', '', 'BxDolService::call(\'payflow\', \'response\', array($this));');
  129. SET @iHandlerId = LAST_INSERT_ID();
  130. INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
  131. ('profile', 'join', @iHandlerId),
  132. ('profile', 'delete', @iHandlerId);
  133. -- email templates
  134. INSERT INTO `sys_email_templates`(`Name`, `Subject`, `Body`, `Desc`, `LangID`) VALUES
  135. ('bx_pfw_paid_need_join', 'Payment was accepted', '<bx_include_auto:_email_header.html />\r\n\r\n<p><b>Dear <RealName></b>,</p>\r\n\r\n<p>\r\nYour payment was accepted. If you did not fill in the join form yet, then you may do it using the following link. \r\n</p>\r\n\r\n<p>\r\n<a href="<JoinLink>">Join Now</a>\r\n</p>\r\n\r\n<bx_include_auto:_email_footer.html />', 'PayPal PayFlow Pro: Paid and need to join', 0);
  136. -- chart
  137. SET @iMaxOrderCharts = (SELECT MAX(`order`)+1 FROM `sys_objects_charts`);
  138. INSERT INTO `sys_objects_charts` (`object`, `title`, `table`, `field_date_ts`, `field_date_dt`, `query`, `active`, `order`) VALUES
  139. (@sModuleName, '_bx_pfw_chart', 'bx_pfw_transactions', 'date', '', '', 1, @iMaxOrderCharts);
  140. -- payments
  141. INSERT INTO `sys_objects_payments` (`object`, `title`, `uri`) VALUES
  142. (@sModuleName, '_sys_module_payflow', 'payflow');
  143. --
  144. -- Hosted Checkout Pages with PayPal PayFlow Pro
  145. --
  146. INSERT INTO `[db_prefix]providers`(`name`, `caption`, `description`, `option_prefix`, `for_visitor`, `class_name`) VALUES
  147. ('hosted_checkout', '_bx_pfw_cpt_hosted_checkout', '_bx_pfw_dsc_hosted_checkout', 'hc_', 0, 'BxPfwHostedCheckout');
  148. SET @iProviderId = LAST_INSERT_ID();
  149. INSERT INTO `[db_prefix]providers_options`(`provider_id`, `name`, `type`, `caption`, `description`, `extra`, `check_type`, `check_params`, `check_error`, `order`) VALUES
  150. (@iProviderId, 'hc_active', 'checkbox', '_bx_pfw_po_active_cpt', '_bx_pfw_po_active_dsc', '', '', '', '', 1),
  151. (@iProviderId, 'hc_mode', 'select', '_bx_pfw_po_mode_cpt', '_bx_pfw_po_mode_dsc', '1|_bx_pfw_po_mode_live,2|_bx_pfw_po_mode_test', '', '', '', 2),
  152. (@iProviderId, 'hc_partner', 'text', '_bx_pfw_po_partner_cpt', '_bx_pfw_po_partner_dsc', '', '', '', '', 3),
  153. (@iProviderId, 'hc_vendor', 'text', '_bx_pfw_po_vendor_cpt', '_bx_pfw_po_vendor_dsc', '', '', '', '', 4),
  154. (@iProviderId, 'hc_user', 'text', '_bx_pfw_po_user_cpt', '_bx_pfw_po_user_dsc', '', '', '', '', 5),
  155. (@iProviderId, 'hc_password', 'text', '_bx_pfw_po_password_cpt', '_bx_pfw_po_password_dsc', '', '', '', '', 6);
  156. --
  157. -- Express Checkout with PayPal PayFlow Pro
  158. --
  159. INSERT INTO `[db_prefix]providers`(`name`, `caption`, `description`, `option_prefix`, `for_visitor`, `class_name`) VALUES
  160. ('express_checkout', '_bx_pfw_cpt_express_checkout', '_bx_pfw_dsc_express_checkout', 'ec_', 1, 'BxPfwExpressCheckout');
  161. SET @iProviderId = LAST_INSERT_ID();
  162. INSERT INTO `[db_prefix]providers_options`(`provider_id`, `name`, `type`, `caption`, `description`, `extra`, `check_type`, `check_params`, `check_error`, `order`) VALUES
  163. (@iProviderId, 'ec_active', 'checkbox', '_bx_pfw_po_active_cpt', '_bx_pfw_po_active_dsc', '', '', '', '', 1),
  164. (@iProviderId, 'ec_mode', 'select', '_bx_pfw_po_mode_cpt', '_bx_pfw_po_mode_dsc', '1|_bx_pfw_po_mode_live,2|_bx_pfw_po_mode_test', '', '', '', 2),
  165. (@iProviderId, 'ec_partner', 'text', '_bx_pfw_po_partner_cpt', '_bx_pfw_po_partner_dsc', '', '', '', '', 3),
  166. (@iProviderId, 'ec_vendor', 'text', '_bx_pfw_po_vendor_cpt', '_bx_pfw_po_vendor_dsc', '', '', '', '', 4),
  167. (@iProviderId, 'ec_user', 'text', '_bx_pfw_po_user_cpt', '_bx_pfw_po_user_dsc', '', '', '', '', 5),
  168. (@iProviderId, 'ec_password', 'text', '_bx_pfw_po_password_cpt', '_bx_pfw_po_password_dsc', '', '', '', '', 6);
  169. --
  170. -- Recurring Billing with PayPal PayFlow Pro
  171. --
  172. INSERT INTO `[db_prefix]providers`(`name`, `caption`, `description`, `option_prefix`, `for_visitor`, `class_name`) VALUES
  173. ('recurring_billing', '_bx_pfw_cpt_recurring_billing', '_bx_pfw_dsc_recurring_billing', 'rb_', 1, 'BxPfwRecurringBilling');
  174. SET @iProviderId = LAST_INSERT_ID();
  175. INSERT INTO `[db_prefix]providers_options`(`provider_id`, `name`, `type`, `caption`, `description`, `extra`, `check_type`, `check_params`, `check_error`, `order`) VALUES
  176. (@iProviderId, 'rb_active', 'checkbox', '_bx_pfw_po_active_cpt', '_bx_pfw_po_active_dsc', '', '', '', '', 1),
  177. (@iProviderId, 'rb_mode', 'select', '_bx_pfw_po_mode_cpt', '_bx_pfw_po_mode_dsc', '1|_bx_pfw_po_mode_live,2|_bx_pfw_po_mode_test', '', '', '', 2),
  178. (@iProviderId, 'rb_partner', 'text', '_bx_pfw_po_partner_cpt', '_bx_pfw_po_partner_dsc', '', '', '', '', 3),
  179. (@iProviderId, 'rb_vendor', 'text', '_bx_pfw_po_vendor_cpt', '_bx_pfw_po_vendor_dsc', '', '', '', '', 4),
  180. (@iProviderId, 'rb_user', 'text', '_bx_pfw_po_user_cpt', '_bx_pfw_po_user_dsc', '', '', '', '', 5),
  181. (@iProviderId, 'rb_password', 'text', '_bx_pfw_po_password_cpt', '_bx_pfw_po_password_dsc', '', '', '', '', 6);