$t('SOAP and DOM'),
'value' => $has_soap && $has_dom ? $t('Enabled') : $t('Not found'),
);
if (!$has_soap || !$has_dom) {
$requirements['uc_cybersource_soap_and_dom']['severity'] = REQUIREMENT_ERROR;
$requirements['uc_cybersource_soap_and_dom']['description'] = $t("CyberSource's SOAP Toolkit API requires the PHP SOAP and DOM libraries.", array('!soap_url' => 'http://php.net/manual/en/soap.setup.php', '!dom_url' => 'http://php.net/manual/en/dom.setup.php'));
}
}
// Using POST with cURL.
elseif ($method == 'post') {
$requirements['uc_cybersource_curl'] = array(
'title' => $t('cURL'),
'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);
if (!$has_curl) {
$requirements['uc_cybersource_curl']['severity'] = REQUIREMENT_ERROR;
$requirements['uc_cybersource_curl']['description'] = $t("CyberSource's Silent Order POST requires the PHP cURL library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php'));
}
}
// We need HOP.php if we're using the post method and also the Hosted Order
// page, which is a payment method rather than a gateway.
if ($method != 'soap') {
require_once('uc_cybersource.module');
$has_cybersource_hop = uc_cybersource_hop_include();
$requirements['uc_cybersource'] = array(
'title' => t('CyberSource HOP.php'),
'value' => $has_cybersource_hop ? $t('Enabled') : $t('Not found'),
);
if (!$has_cybersource_hop) {
$requirements['uc_cybersource']['description'] = t('For instructions on how to generate this file, please refer to CyberSource\'s Hosted Order Pages Documentation, specifically the "Downloading Security Scripts" in Chapter 2 of the HOP User\'s Guide.');
$severity = $phase == 'install' ? REQUIREMENT_INFO : REQUIREMENT_ERROR;
$requirements['uc_cybersource']['severity'] = $severity;
}
else {
$requirements['uc_cybersource']['severity'] = REQUIREMENT_OK;
$requirements['uc_cybersource']['description'] = t('The HOP.php library is readable.');
}
}
return $requirements;
}
/**
* Implements hook_uninstall().
*/
function uc_cybersource_uninstall() {
// Delete related variables all at once.
db_delete('variable')
->condition(db_or()
->condition('name', 'uc_cybersource_%', 'LIKE')
->condition('name', 'cs_ship_from_%', 'LIKE')
)
->execute();
}
/**
* Implements hook_schema().
*/
function uc_cybersource_schema() {
$schema['uc_payment_cybersource_hop_post'] = array(
'fields' => array(
'order_id' => array(
'description' => 'The order ID as provided by the store.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'request_id' => array(
'description' => 'Unique id assigned by CyberSource that identifies payment request.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'request_token' => array(
'description' => 'Verification token associated with the request ID.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'reconciliation_id' => array(
'description' => 'Reference number generated by CyberSource that you use to reconcile your CyberSource reports with your processor reports.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'gross' => array(
'description' => 'The approved payment amount from CyberSource.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'decision' => array(
'description' => 'CyberSource decision for payment request.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'reason_code' => array(
'description' => 'A code for decision.',
'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,
),
),
);
return $schema;
}
/**
* Implements hook_update_last_removed().
*/
function uc_cybersource_update_last_removed() {
return 2;
}