public static RefundResponse InvokeRefund(IOffAmazonPaymentsService service, RefundRequest request)
        {
            RefundResponse response = null;

            try
            {
                response = service.Refund(request);
                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();
                Console.WriteLine("        RefundResponse");
                if (response.IsSetRefundResult())
                {
                    Console.WriteLine("            RefundResult");
                    RefundResult refundResult = response.RefundResult;
                    if (refundResult.IsSetRefundDetails())
                    {
                        Console.WriteLine("                RefundDetails");
                        RefundDetails refundDetails = refundResult.RefundDetails;
                        if (refundDetails.IsSetAmazonRefundId())
                        {
                            Console.WriteLine("                    AmazonRefundId");
                            Console.WriteLine("                        {0}", refundDetails.AmazonRefundId);
                        }
                        if (refundDetails.IsSetRefundReferenceId())
                        {
                            Console.WriteLine("                    RefundReferenceId");
                            Console.WriteLine("                        {0}", refundDetails.RefundReferenceId);
                        }
                        if (refundDetails.IsSetSellerRefundNote())
                        {
                            Console.WriteLine("                    SellerRefundNote");
                            Console.WriteLine("                        {0}", refundDetails.SellerRefundNote);
                        }
                        if (refundDetails.IsSetRefundType())
                        {
                            Console.WriteLine("                    RefundType");
                            Console.WriteLine("                        {0}", refundDetails.RefundType);
                        }
                        if (refundDetails.IsSetFeeRefunded())
                        {
                            Console.WriteLine("                    FeeRefunded");
                            Price feeRefunded = refundDetails.FeeRefunded;
                            if (feeRefunded.IsSetAmount())
                            {
                                Console.WriteLine("                        Amount");
                                Console.WriteLine("                            {0}", feeRefunded.Amount);
                            }
                            if (feeRefunded.IsSetCurrencyCode())
                            {
                                Console.WriteLine("                        CurrencyCode");
                                Console.WriteLine("                            {0}", feeRefunded.CurrencyCode);
                            }
                        }
                        if (refundDetails.IsSetCreationTimestamp())
                        {
                            Console.WriteLine("                    CreationTimestamp");
                            Console.WriteLine("                        {0}", refundDetails.CreationTimestamp);
                        }
                        if (refundDetails.IsSetProviderCreditReversalSummaryList())
                        {
                            foreach (ProviderCreditReversalSummary providerCreditReversalSummary in refundDetails.ProviderCreditReversalSummaryList.member)
                            {
                                if (providerCreditReversalSummary.IsSetProviderCreditReversalId())
                                {
                                    Console.WriteLine("                    ProviderCreditReversalId");
                                    Console.WriteLine("                        {0}", providerCreditReversalSummary.ProviderCreditReversalId);
                                }
                                if (providerCreditReversalSummary.IsSetProviderId())
                                {
                                    Console.WriteLine("                    ProviderId");
                                    Console.WriteLine("                        {0}", providerCreditReversalSummary.ProviderId);
                                }
                            }
                        }
                        if (refundDetails.IsSetRefundStatus())
                        {
                            Console.WriteLine("                    RefundStatus");
                            Status refundStatus = refundDetails.RefundStatus;
                            if (refundStatus.IsSetState())
                            {
                                Console.WriteLine("                        State");
                                Console.WriteLine("                            {0}", refundStatus.State);
                            }
                            if (refundStatus.IsSetLastUpdateTimestamp())
                            {
                                Console.WriteLine("                        LastUpdateTimestamp");
                                Console.WriteLine("                            {0}", refundStatus.LastUpdateTimestamp);
                            }
                            if (refundStatus.IsSetReasonCode())
                            {
                                Console.WriteLine("                        ReasonCode");
                                Console.WriteLine("                            {0}", refundStatus.ReasonCode);
                            }
                            if (refundStatus.IsSetReasonDescription())
                            {
                                Console.WriteLine("                        ReasonDescription");
                                Console.WriteLine("                            {0}", refundStatus.ReasonDescription);
                            }
                        }
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
            }
            catch (OffAmazonPaymentsServiceException ex)
            {
                PrintException(ex);
            }
            return(response);
        }