com.google.checkout.orderprocessing
Class RefundOrderRequest

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

public class RefundOrderRequest
extends AbstractOrderProcessingRequest

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

Author:
Charles Dang (cdang@google.com)

Field Summary
static java.lang.String REFUND_ERROR_STRING
           
static int REFUND_STRING_LIMIT
           
 
Fields inherited from class com.google.checkout.AbstractCheckoutRequest
merchantInfo
 
Constructor Summary
RefundOrderRequest(MerchantInfo merchantInfo)
          Constructor which takes an instance of MerchantInfo.
RefundOrderRequest(MerchantInfo merchantInfo, java.lang.String googleOrderNumber, java.lang.String reason)
          Constructor which takes an instance of MerchantInfo, the Google order number and the reason for the refund.
RefundOrderRequest(MerchantInfo merchantInfo, java.lang.String googleOrderNumber, java.lang.String reason, float amount, java.lang.String comment)
          Constructor which takes an instance of MerchantInfo, the Google order number, the reason for the refund, the refund amount and any additional comment.
 
Method Summary
 float getAmount()
          Return the refund amount, which is value of the <amount> tag.
 java.lang.String getComment()
          Return the refund comment String, which is the value of the <comment> tag.
 java.lang.String getReason()
          Return the refund reason String, which is the value of the <reason> tag.
 boolean isWithinRefundStringLimits(java.lang.String reason, java.lang.String comment)
          Determine whether the reason and comment are within the string length limits.
 void setAmount(float amount)
          Set the refund amount, which is value of the <amount> tag.
 void setComment(java.lang.String comment)
          Set the refund order comment String, which is the value of the <comment> tag.
 void setReason(java.lang.String reason)
          Set the refund 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

REFUND_STRING_LIMIT

public static final int REFUND_STRING_LIMIT
See Also:
Constant Field Values

REFUND_ERROR_STRING

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

RefundOrderRequest

public RefundOrderRequest(MerchantInfo merchantInfo)
Constructor which takes an instance of MerchantInfo.

Parameters:
merchantInfo - The merchant's information.

RefundOrderRequest

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

Parameters:
merchantInfo - The merchant's information.
googleOrderNumber - The Google order number.
reason - The reason for the refund.

RefundOrderRequest

public RefundOrderRequest(MerchantInfo merchantInfo,
                          java.lang.String googleOrderNumber,
                          java.lang.String reason,
                          float amount,
                          java.lang.String comment)
                   throws CheckoutException
Constructor which takes an instance of MerchantInfo, the Google order number, the reason for the refund, the refund amount and any additional comment.

Parameters:
merchantInfo - The merchant's information.
googleOrderNumber - The Google order number.
reason - The reason for the refund.
amount - The amount to refund the buyer.
comment - Any additional comment needed.
Throws:
CheckoutException - if merchantInfo, reason or comment is null.
Method Detail

isWithinRefundStringLimits

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

Parameters:
reason - The reason for the refund.
comment - Any additional comment needed.
Returns:
True if the reason and the comment strings are within the allowable limit; otherwise false.
Throws:
CheckoutException - if reason or comment is null.

getAmount

public float getAmount()
Return the refund amount, which is value of the <amount> tag.

Returns:
The refund amount.

getComment

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

Returns:
The refund comment String.

getReason

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

Returns:
The refund reason String.

setAmount

public void setAmount(float amount)
               throws CheckoutException
Set the refund amount, which is value of the <amount> tag.

Parameters:
amount - The refund amount.
Throws:
CheckoutException - if amount <= 0.

setComment

public void setComment(java.lang.String comment)
                throws CheckoutException
Set the refund order comment String, which is the value of the <comment> tag. Comment will be truncated if it exceeds the refund string limit. See RefundOrderRequest.REFUND_STRING_LIMIT.

Parameters:
comment - The refund comment String.
Throws:
CheckoutException - if comment is null.

setReason

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

Parameters:
reason - The refund reason String.
Throws:
CheckoutException - if reason is null.