com.google.checkout.orderprocessing
Class CancelOrderRequest

java.lang.Object
  extended by com.google.checkout.AbstractCheckoutRequest
      extended by com.google.checkout.orderprocessing.AbstractOrderProcessingRequest
          extended by com.google.checkout.orderprocessing.CancelOrderRequest

public class CancelOrderRequest
extends AbstractOrderProcessingRequest

This class contains methods that construct <cancel-order> API requests.

Author:
Charles Dang (cdang@google.com)

Field Summary
static java.lang.String CANCEL_ERROR_STRING
           
static int CANCEL_STRING_LIMIT
           
 
Fields inherited from class com.google.checkout.AbstractCheckoutRequest
merchantInfo
 
Constructor Summary
CancelOrderRequest(MerchantInfo merchantInfo)
          Constructor which takes an instance of MerchantInfo
CancelOrderRequest(MerchantInfo merchantInfo, java.lang.String googleOrderNumber, java.lang.String reason)
          Constructor which takes an instance of MerchantInfo, Google order number and the reason for the cancellation.
CancelOrderRequest(MerchantInfo merchantInfo, java.lang.String googleOrderNo, java.lang.String reason, java.lang.String comment)
          Constructor which takes an instance of merchantInfo, Google order number, reason for cancellation and comment.
 
Method Summary
 java.lang.String getComment()
          Return the cancel order comment String, which is the value of the <comment> tag.
 java.lang.String getReason()
          Return the cancel order reason String, which is the value of the <reason> tag.
 boolean isWithinCancelStringLimits(java.lang.String reason, java.lang.String comment)
          Determine whether the reason and comment are within the string length limits.
 void setComment(java.lang.String comment)
          Set the cancel order comment String, which is the value of the <comment> tag.
 void setReason(java.lang.String reason)
          Set the cancel order reason String, which is the value of the <reason> tag.
 
Methods inherited from class com.google.checkout.orderprocessing.AbstractOrderProcessingRequest
getGoogleOrderNo, getGoogleOrderNumber, setGoogleOrderNo, setGoogleOrderNumber
 
Methods inherited from class com.google.checkout.AbstractCheckoutRequest
getDocument, getPostUrl, getRoot, getXml, getXmlPretty, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANCEL_STRING_LIMIT

public static final int CANCEL_STRING_LIMIT
See Also:
Constant Field Values

CANCEL_ERROR_STRING

public static final java.lang.String CANCEL_ERROR_STRING
See Also:
Constant Field Values
Constructor Detail

CancelOrderRequest

public CancelOrderRequest(MerchantInfo merchantInfo)
Constructor which takes an instance of MerchantInfo

Parameters:
merchantInfo - The merchant's information.

CancelOrderRequest

public CancelOrderRequest(MerchantInfo merchantInfo,
                          java.lang.String googleOrderNumber,
                          java.lang.String reason)
Constructor which takes an instance of MerchantInfo, Google order number and the reason for the cancellation.

Parameters:
googleOrderNumber - The Google order number.
reason - The reason for the cancellation.

CancelOrderRequest

public CancelOrderRequest(MerchantInfo merchantInfo,
                          java.lang.String googleOrderNo,
                          java.lang.String reason,
                          java.lang.String comment)
Constructor which takes an instance of merchantInfo, Google order number, reason for cancellation and comment.

Parameters:
googleOrderNo - The Google order number.
reason - The reason for cancellation.
comment - An additional comment.
Throws:
CheckoutException - if merchantInfo is null.
Method Detail

isWithinCancelStringLimits

public boolean isWithinCancelStringLimits(java.lang.String reason,
                                          java.lang.String comment)
Determine whether the reason and comment are within the string length limits. See CancelOrderRequest.CANCEL_STRING_LIMIT for the maximum allowed length for reason and comment.

Parameters:
reason - The reason for cancellation.
comment - An additional comment.
Returns:
True if the cancellation reason and the additional comment are within the allowed limits.
Throws:
CheckoutException - if reason is null or if comment if null.

getComment

public java.lang.String getComment()
Return the cancel order comment String, which is the value of the <comment> tag.

Returns:
The cancel order comment String.

getReason

public java.lang.String getReason()
Return the cancel order reason String, which is the value of the <reason> tag.

Returns:
The cancel order reason String.

setComment

public void setComment(java.lang.String comment)
Set the cancel order comment String, which is the value of the <comment> tag. Comment will be truncated if it exceeds the cancel string limit. See CancelOrderRequest.CANCEL_STRING_LIMIT.

Parameters:
comment - A comment associated with the cancellation.

setReason

public void setReason(java.lang.String reason)
Set the cancel order reason String, which is the value of the <reason> tag. Reason will be truncated if it exceeds the reason string limit. See CancelOrderRequest.CANCEL_STRING_LIMIT.

Parameters:
reason - The reason for cancellation.