function uc_recurring_cybersource_profile_form in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.2 includes/uc_recurring.uc_cybersource.inc \uc_recurring_cybersource_profile_form()
List the profile information.
1 string reference to 'uc_recurring_cybersource_profile_form'
- uc_recurring_uc_cybersource_recurring_info in includes/
uc_recurring.uc_cybersource.inc - Implements hook_recurring_info().
File
- includes/
uc_recurring.uc_cybersource.inc, line 314 - Uc recurring implementation for the CyberSource module.
Code
function uc_recurring_cybersource_profile_form($form, $form_state, $rfid) {
$fee = uc_recurring_fee_user_load($rfid);
$order = uc_order_load($fee->order_id);
$refs = array_keys($order->data['cc_txns']['references']);
$subscription_id = end($refs);
module_load_include('inc', 'uc_cybersource', 'uc_cybersource.soap');
try {
$soapClient = new CyberSourceSoapClient(_uc_recurring_cybersource_soap_wsdl_url(), array());
$login = _uc_cybersource_soap_login_data();
// Create the request with some meta data.
$request = new stdClass();
$request->merchantID = $login['merchant_id'];
$request->merchantReferenceCode = $order->order_id;
$paySubscriptionRetrieveService = new stdClass();
$paySubscriptionRetrieveService->run = 'true';
$request->paySubscriptionRetrieveService = $paySubscriptionRetrieveService;
$recurringSubscriptionInfo = new stdClass();
$recurringSubscriptionInfo->subscriptionID = $subscription_id;
$request->recurringSubscriptionInfo = $recurringSubscriptionInfo;
$reply = $soapClient
->runTransaction($request);
} catch (SoapFault $exception) {
// Log and display errors if Ubercart is unable to connect via SOAP.
watchdog('uc_cybersource', 'Unable to connect to CyberSource via SOAP.', array(), WATCHDOG_ERROR);
drupal_set_message(t('We apologize for the delay, but we are unable to process your credit card at this time. Please <a href="!url">contact sales</a> to complete your order.', array(
'!url' => url('contact'),
)), 'error');
}
if (isset($reply->paySubscriptionRetrieveReply)) {
$header = $rows = $row = array();
foreach ($reply->paySubscriptionRetrieveReply as $key => $val) {
$header[] = $key;
$row[] = $val;
}
$rows[] = $row;
$form['info'] = array(
'#markup' => t('The profile details below were returned from CyberSource'),
);
$form['profile'] = array(
'#markup' => theme('table', array(
'header' => $header,
'rows' => $rows,
)),
);
$form['return'] = array(
'#markup' => l(t('Return'), 'admin/store/orders/recurring/view/fee/' . $rfid),
);
}
else {
drupal_set_message(t('Invalid response from SOAP server while retrieving subscription @subscription_id', array(
'@subscription_id' => $subscription_id,
)), 'error');
}
return $form;
}