$t('cURL'), 'value' => $has_curl ? $t('Enabled') : $t('Not found'), ); if (!$has_curl) { $requirements['uc_paypal_curl']['severity'] = REQUIREMENT_ERROR; $requirements['uc_paypal_curl']['description'] = $t("PayPal WPP requires the PHP cURL library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php')); } } return $requirements; } /** * Implementation of hook_schema(). */ function uc_paypal_schema() { $schema = array(); $schema['uc_payment_paypal_ipn'] = array( 'description' => 'Logs PayPal Instant Payment Notifications.', 'fields' => array( 'order_id' => array( 'description' => 'The order ID.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'txn_id' => array( 'description' => 'The transaction ID from PayPal.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'txn_type' => array( 'description' => 'The transaction type from PayPal.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'mc_gross' => array( 'description' => 'The payment amount from PayPal.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'status' => array( 'description' => 'The IPN status from PayPal.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'receiver_email' => array( 'description' => 'The e-mail address of the PayPal account.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'payer_email' => array( 'description' => 'The e-mail address of the buyer.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'received' => array( 'description' => 'The IPN receipt timestamp.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), ), 'indexes' => array( 'order_id' => array('order_id'), ), ); return $schema; } /** * Implementation of hook_install(). */ function uc_paypal_install() { drupal_install_schema('uc_paypal'); $t = get_t(); db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('paypal_pending', '%s', 'payment_received', 7, 1);", $t('PayPal pending')); } /** * Implementation of hook_uninstall(). */ function uc_paypal_uninstall() { drupal_uninstall_schema('uc_paypal'); db_query("DELETE FROM {variable} WHERE name LIKE 'uc_paypal_%%'"); } function uc_paypal_update_1() { // Clean out the old order status table and redefine its structure. if ($_SESSION['statuses'] !== TRUE) { $ret[] = update_sql("ALTER TABLE {uc_order_statuses} CHANGE order_status_id order_status_id VARCHAR(32) CHARACTER SET utf8 NOT NULL default ''"); $ret[] = update_sql("ALTER TABLE {uc_order_statuses} CHANGE title title VARCHAR(48) CHARACTER SET utf8 NOT NULL default ''"); $ret[] = update_sql("ALTER TABLE {uc_order_statuses} CHANGE notify state VARCHAR(32) CHARACTER SET utf8 NOT NULL default ''"); $ret[] = update_sql("ALTER TABLE {uc_order_statuses} ADD weight MEDIUMINT(9) NOT NULL"); $ret[] = update_sql("ALTER TABLE {uc_order_statuses} ADD locked TINYINT NOT NULL DEFAULT '0'"); $ret[] = update_sql("DELETE FROM {uc_order_statuses} WHERE order_status_id LIKE '_'"); $_SESSION['statuses'] = TRUE; } $t = get_t(); $ret[] = update_sql("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('paypal_pending', '". $t('PayPal pending') ."', 'payment_received', 7, 1);"); return $ret; } function uc_paypal_update_2() { // Change the variable used to define the default transaction type. if (variable_get('uc_paypal_wpp_payment_action', 'Sale') == 'Sale') { variable_set('uc_pg_paypal_wpp_cc_txn_type', UC_CREDIT_AUTH_CAPTURE); } else { variable_set('uc_pg_paypal_wpp_cc_txn_type', UC_CREDIT_AUTH_ONLY); } variable_del('uc_paypal_wpp_payment_action'); // Fix a bug in a variable name. variable_set('uc_paypal_wps_submit_method', variable_get('uc_paypal_wbs_submit_method', 'single')); variable_del('uc_paypal_wbs_submit_method'); return array(); } function uc_paypal_update_6000() { $ret = array(); db_drop_index($ret, 'uc_payment_paypal_ipn', 'order_id'); db_change_field($ret, 'uc_payment_paypal_ipn', 'order_id', 'order_id', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), array('indexes' => array('order_id' => array('order_id')))); db_change_field($ret, 'uc_payment_paypal_ipn', 'received', 'received', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); return $ret; }