public static GetRefundDetailsResponse CheckRefundStatus(string amazonRefundId, IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection)
        {
            //used to check if the refund is time-out
            TimeSpan startTime = DateTime.Now.TimeOfDay;
            GetRefundDetailsRequest refundDetailRequest = new GetRefundDetailsRequest();

            refundDetailRequest.SellerId       = propertiesCollection.MerchantID;
            refundDetailRequest.AmazonRefundId = amazonRefundId;

            GetRefundDetailsResponse getRefundDetailsResponse = GetRefundDetailsSample.InvokeGetRefundDetails(service, refundDetailRequest);

            while (getRefundDetailsResponse.IsSetGetRefundDetailsResult() && getRefundDetailsResponse.GetRefundDetailsResult.RefundDetails.RefundStatus.State.Equals(PaymentStatus.PENDING))
            {
                if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000)
                {
                    throw new OffAmazonPaymentsServiceException("The refund has timed-out.");
                }

                System.Threading.Thread.Sleep(8000);
                Console.WriteLine("Waiting until the Refund Status changes from PENDING");
                getRefundDetailsResponse = GetRefundDetailsSample.InvokeGetRefundDetails(service, refundDetailRequest);
            }

            return(getRefundDetailsResponse);
        }
        public static GetRefundDetailsResponse GetRefundDetails(IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection, string amazonRefundId)
        {
            GetRefundDetailsRequest request = new GetRefundDetailsRequest();

            request.SellerId       = propertiesCollection.MerchantID;
            request.AmazonRefundId = amazonRefundId;
            return(GetRefundDetailsSample.InvokeGetRefundDetails(service, request));
        }
 //Invoke the GetRefundDetails method
 public GetRefundDetailsResponse GetRefundDetails(RefundResponse response)
 {
     return(GetRefundDetailsSample.GetRefundDetails(this._service, this._propertiesCollection, response.RefundResult.RefundDetails.AmazonRefundId));
 }