You are here

function uc_paypal_install in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_paypal/uc_paypal.install \uc_paypal_install()
  2. 7.3 payment/uc_paypal/uc_paypal.install \uc_paypal_install()

Implementation of hook_install().

File

payment/uc_paypal/uc_paypal.install, line 6

Code

function uc_paypal_install() {
  $t = get_t();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {uc_payment_paypal_ipn} (\n        order_id int(11) NOT NULL,\n        txn_id varchar(255) NOT NULL,\n        txn_type varchar(255) NOT NULL,\n        mc_gross varchar(255) NOT NULL,\n        status varchar(255) NOT NULL,\n        receiver_email varchar(255) NOT NULL,\n        payer_email varchar(255) NOT NULL,\n        received int(11) NOT NULL,\n        KEY order_id (order_id)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('paypal_pending', '" . $t('PayPal pending') . "', 'payment_received', 7, 1);");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {uc_payment_paypal_ipn} (\n        order_id integer NOT NULL,\n        txn_id varchar(255) NOT NULL,\n        txn_type varchar(255) NOT NULL,\n        mc_gross varchar(255) NOT NULL,\n        status varchar(255) NOT NULL,\n        receiver_email varchar(255) NOT NULL,\n        payer_email varchar(255) NOT NULL,\n        received integer NOT NULL\n      );");
      db_query("CREATE INDEX {uc_payment_paypal_ipn}_order_id ON {uc_payment_paypal_ipn} (order_id)");
      db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('paypal_pending', '" . $t('PayPal pending') . "', 'payment_received', 7, 1);");
      break;
  }
}