Operation
Response Undo(string sessionToken, Undo differenceData, string applicationProfileId, string workflowId);
Parameters
Parameter |
Data Type |
Description |
sessionToken |
String |
The limited-life token used to authenticate to CWS. |
differenceData |
Undo |
The transactionId of the transaction to void.
Note: You must send in BankcardUndo for Bankcard transactions. |
applicationProfileId |
String |
A token representing the PTLS Socket ID unique to each Service Key and configuration data combination. Returned by the SaveApplicationData operation. |
serviceId |
String |
Conditional. Unique identifier for available services returned in the ServiceInformation object when invoking the GetServiceInformation operation. Required when not supporting workflows. |
workflowId |
String |
Identifies the workflow to use for the transaction. If not supporting custom workflows, pass the serviceId returned by GetServiceInformation . |
Return Type
Data Type |
Description |
Response |
Transaction response data.
Note: For Bankcard (BCP) transactions, the response object is BankcardTransactionResponsePro . |
Exceptions
CWSFault |
CWSInvalidOperationFault |
AuthenticationFault |
CWSInvalidServiceInformationFault |
ExpiredTokenFault |
CWSOperationNotSupportedFault |
InvalidTokenFault |
CWSTransactionAlreadySettledFault |
CWSConnectionFault |
CWSTransactionFailedFault |
CWSExtendedDataNotSupportedFault |
CWSTransactionServiceUnavailableFault |
CWSInvalidMessageFormatFault |
CWSValidationResultFault |
For additional details about each fault, refer to Transaction Processing Faults in the CWS Developer API Reference.
Code Snippets
public Response Undo(string sessionToken, Undo undo, string applicationProfileId, string workflowId)
{
using (var client = new CwsTransactionProcessingClient(ConfigurationManager.AppSettings["Bindings.TxnSoap"]))
{
try
{
return client.Undo(sessionToken, undo, applicationProfileId, workflowId);
}
catch (FaultException ex)
{
SoapFaultHandler.HandleFaultException(ex);
}
}
}
/* NOTE: Use this function to void an authorized transaction
* $transactionID is the known transaction ID of a previous transaction*/
public function undo($transactionID, $creds = null, $txnType = null)
{
if (! $this->signOn ())
return false;
if ($this->svc instanceof BankcardService || $txnType == "BCP")
{
$differenceData = new BankcardUndo();
}
if ($this->svc instanceof ElectronicCheckingService || $txnType == "ECK")
{
$differenceData = new UndoDifferenceData();
}
$differenceData->TransactionId = $transactionID;
if ($creds != null)
{
$differenceData->Addendum = new Addendum ();
$differenceData->Addendum->Unmanaged = new Unmanaged ();
$differenceData->Addendum->Unmanaged->Any = new Any ();
$differenceData->Addendum->Unmanaged->Any->string = $creds;
}
// Build Undo
$trans = new Undo ();
$trans->sessionToken = $this->session_token;
$trans->differenceData = $differenceData;
$trans->workflowId = $this->workflowId;
$trans->applicationProfileId = $this->appProfileID;
//var_dump($trans);
try
{
$response = $this->bankCard->Undo ( $trans )->UndoResult;
//echo ($this->bankCard->__getLastRequest ());
return $response;
}
catch ( SoapFault $e )
{
echo 'SERVER ERROR: Error trying to Undo.
';
echo ('
'.$this->bankCard->__getLastRequestHeaders());
echo ('
' . $this->bankCard->__getLastRequest ());
echo ('
' . $this->bankCard->__getLastResponse ());
$xmlFault = $this->bankCard->__getLastResponse ();
$errors = handleTxnFault ( $e, $xmlFault );
echo $errors;
exit ();
}
}