private static GetAuthorizationDetailsResponse GetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request)
        {
            GetAuthorizationDetailsResponse response = null;

            response = service.GetAuthorizationDetails(request);
            return(response);
        }
        public static GetAuthorizationDetailsResponse GetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request, TextWriter buffer)
        {
            GetAuthorizationDetailsResponse response = GetAuthorizationDetails(service, request);

            printGetAuthorizationDetailsResponseToBuffer(response, buffer);
            return(response);
        }
        //Use a loop to check the status of authorization. Once the status is not "PENDING", skip the loop.
        public static GetAuthorizationDetailsResponse CheckAuthorizationStatus(string amazonAuthorizationId, OffAmazonPaymentsServicePropertyCollection propertiesCollection,
                                                                               IOffAmazonPaymentsService service)
        {
            //used to check if the authorization is time-out
            TimeSpan startTime = DateTime.Now.TimeOfDay;
            GetAuthorizationDetailsRequest authDetailRequest = new GetAuthorizationDetailsRequest();

            authDetailRequest.SellerId = propertiesCollection.MerchantID;
            authDetailRequest.AmazonAuthorizationId = amazonAuthorizationId;

            GetAuthorizationDetailsResponse getAuthResponse = GetAuthorizationDetailsSample.InvokeGetAuthorizationDetails(service, authDetailRequest);

            while (getAuthResponse.IsSetGetAuthorizationDetailsResult() && getAuthResponse.GetAuthorizationDetailsResult.AuthorizationDetails.AuthorizationStatus.State.Equals(PaymentStatus.PENDING))
            {
                if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000)
                {
                    throw new OffAmazonPaymentsServiceException("The authorization is time-out.");
                }

                System.Threading.Thread.Sleep(8000);
                Console.WriteLine("Waiting until the Authorization Status becomes OPEN");
                getAuthResponse = GetAuthorizationDetailsSample.InvokeGetAuthorizationDetails(service, authDetailRequest);
            }

            return(getAuthResponse);
        }
        private void MakePayment(OffAmazonPaymentsServiceAutomaticPaymentsSimpleCheckout automaticPayments,
                                 string totalAmount, int indicator, bool captureNow)
        {
            lblNotification.Text += "<br>-----Making payment with indicator " + indicator.ToString() + "<br>";

            /************************************************************************
             * Invoke Authorize on Billing Agreement Action
             ***********************************************************************/
            AuthorizeOnBillingAgreementResponse authResponse = automaticPayments.AuthorizeOnBillingAgreement(totalAmount, indicator, captureNow);

            if (authResponse == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from AuthorizeOnBillingAgreement request is null");
            }

            /************************************************************************
             * Wait for the notification from ipn.aspx page in a loop, then print the corresponding information
             ***********************************************************************/
            lblNotification.Text += formatStringForDisplay(WaitAndGetNotificationDetails(authResponse.AuthorizeOnBillingAgreementResult.AuthorizationDetails.AmazonAuthorizationId + "_Authorize"));
            GetAuthorizationDetailsResponse response = automaticPayments.CheckAuthorizationStatus(authResponse);

            /************************************************************************
             * On an IPN callback, call GetAuthorizationDetails to retreive additional
             * information about the authorization - this is done as part of the
             * previous call to check the status.
             ***********************************************************************/
            StringWriter stringWriter = new StringWriter();

            GetAuthorizationDetailsSample.printGetAuthorizationDetailsResponseToBuffer(response, stringWriter);
            lblNotification.Text += formatStringForDisplay(stringWriter.ToString());

            if (!captureNow)
            {
                /************************************************************************
                 * Invoke Capture Action
                 ***********************************************************************/
                CaptureResponse captureResponse = automaticPayments.Capture(authResponse, totalAmount, indicator);
                if (captureResponse == null)
                {
                    throw new OffAmazonPaymentsServiceException("The response from Capture request is null");
                }

                /************************************************************************
                 * Wait for the notification from ipn.aspx page in a loop, then print the corresponding information
                 ***********************************************************************/
                lblNotification.Text += formatStringForDisplay(WaitAndGetNotificationDetails(captureResponse.CaptureResult.CaptureDetails.AmazonCaptureId + "_Capture"));

                /************************************************************************
                 * Invoke Get Capture Details Action
                 ***********************************************************************/
                if (automaticPayments.GetCaptureDetail(captureResponse) == null)
                {
                    throw new OffAmazonPaymentsServiceException("The response from GetCaptureDetail request is null");
                }
            }

            lblNotification.Text += "-----Payment with indicator " + indicator.ToString() + " is complete<br><br>";
        }
Beispiel #5
0
        private void RunSample(OffAmazonPaymentsServiceProviderCheckout providerCheckout,
                               string orderReferenceId, string orderAmount, int shippingOption, int authorizationOption, string providerId, string creditAmount)
        {
            /************************************************************************
             * Invoke Get Order Reference Details Action
             ***********************************************************************/
            GetOrderReferenceDetailsResponse getOrderDetails = providerCheckout.GetOrderReferenceDetails();

            if (getOrderDetails == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from GetOrderReference request is null");
            }

            /************************************************************************
             * Add the tax and shipping rates here
             * Get the rates by using the CountryCode and the StateOrRegionCode from the orderReferenceDetails
             ***********************************************************************/
            Destination         destination = getOrderDetails.GetOrderReferenceDetailsResult.OrderReferenceDetails.Destination;
            TaxAndShippingRates rates       = new TaxAndShippingRates(destination);
            string totalAmount = rates.getTotalAmountWithTaxAndShipping(Convert.ToDouble(orderAmount), shippingOption).ToString("0.##");

            Address address = destination.PhysicalDestination;

            lblShipping.Text = "The shipping address is: <br>" + address.City + "<br>" + address.StateOrRegion + "<br>" + address.PostalCode + "<br>"
                               + "The total amount with tax and shipping is: " + totalAmount + "<br>";

            /************************************************************************
             * Invoke Set Order Reference Details Action
             ***********************************************************************/
            SetOrderReferenceDetailsResponse setOrderDetailsResponse = providerCheckout.SetOrderReferenceDetails(totalAmount);

            if (setOrderDetailsResponse == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from SetOrderReference request is null");
            }

            /************************************************************************
             * Invoke Confirm Order Reference Action
             ***********************************************************************/
            if (providerCheckout.ConfirmOrderReferenceObject() == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from ConfirmOrderResponse request is null");
            }

            /************************************************************************
             * Invoke Authorize Action
             ***********************************************************************/
            AuthorizeResponse authResponse = providerCheckout.AuthorizeAction(setOrderDetailsResponse, authorizationOption);

            if (authResponse == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from Authorization Response request is null");
            }

            /************************************************************************
             * Wait for the notification from ipn.aspx page in a loop, then print the corresponding information
             ***********************************************************************/
            lblNotification.Text += formatStringForDisplay(WaitAndGetNotificationDetails(authResponse.AuthorizeResult.AuthorizationDetails.AmazonAuthorizationId + "_Authorize"));
            GetAuthorizationDetailsResponse response = providerCheckout.CheckAuthorizationStatus(authResponse);

            /************************************************************************
             * On an IPN callback, call GetAuthorizationDetails to retreive additional
             * information about the authorization - this is done as part of the
             * previous call to check the status.
             ***********************************************************************/
            StringWriter stringWriter = new StringWriter();

            GetAuthorizationDetailsSample.printGetAuthorizationDetailsResponseToBuffer(response, stringWriter);
            lblNotification.Text += formatStringForDisplay(stringWriter.ToString());

            /************************************************************************
             * Invoke Capture Action
             ***********************************************************************/
            CaptureResponse captureResponse = providerCheckout.CaptureActionWithProviderCredit(authResponse, totalAmount, providerId, creditAmount);

            if (captureResponse == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from Caputre Response request is null");
            }

            /************************************************************************
             * Wait for the notification from ipn.aspx page in a loop, then print the corresponding information
             ***********************************************************************/
            lblNotification.Text += formatStringForDisplay(WaitAndGetNotificationDetails(captureResponse.CaptureResult.CaptureDetails.AmazonCaptureId + "_Capture"));

            /************************************************************************
             * Invoke Get Capture Details Action
             ***********************************************************************/
            GetCaptureDetailsResponse getCaptureDetailsResponse = providerCheckout.GetCaptureDetails(captureResponse);

            if (getCaptureDetailsResponse == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from GetCaputreDetails Response request is null");
            }

            /************************************************************************
             * Invoke GetProviderCreditDetails Action
             ***********************************************************************/
            if (!String.IsNullOrEmpty(providerId) && !String.IsNullOrEmpty(creditAmount))
            {
                /************************************************************************
                 * Wait till the the ProviderCreditSummaryList is available in the GetCaptureDetailsResponse
                 ***********************************************************************/
                OffAmazonPaymentsService.Model.ProviderCreditSummaryList providerCreditSummaryList = providerCheckout.CheckCaptureForProviderCreditSummaryList(captureResponse);
                foreach (OffAmazonPaymentsService.Model.ProviderCreditSummary providerCreditSummary in providerCreditSummaryList.member)
                {
                    /************************************************************************
                     * Wait for the notification from ipn.aspx page in a loop, then print the corresponding information
                     ***********************************************************************/
                    lblNotification.Text += formatStringForDisplay(WaitAndGetNotificationDetails(providerCreditSummary.ProviderCreditId + "_ProviderCredit"));
                    GetProviderCreditDetailsResponse getProviderCreditDetailsResponse = providerCheckout.GetProviderCreditDetails(providerCreditSummary);
                    if (getProviderCreditDetailsResponse == null)
                    {
                        throw new OffAmazonPaymentsServiceException("The response from GetProviderCreditDetails request is null for ProviderCreditId:" + providerCreditSummary.ProviderCreditId);
                    }
                }
            }

            /************************************************************************
             * Invoke CloseOrderReference Action
             ***********************************************************************/
            if (providerCheckout.CloseOrderReference() == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from CloseOrderReference Response request is null");
            }

            /************************************************************************
             * Wait for the notification from ipn.aspx page in a loop, then print the corresponding information
             ***********************************************************************/
            lblNotification.Text += formatStringForDisplay(WaitAndGetNotificationDetails(orderReferenceId + "_OrderReference"));
        }
 public static void printGetAuthorizationDetailsResponseToBuffer(GetAuthorizationDetailsResponse response, TextWriter writer)
 {
     writer.WriteLine("Service Response");
     writer.WriteLine("=============================================================================");
     writer.WriteLine();
     writer.WriteLine("        GetAuthorizationDetailsResponse");
     if (response.IsSetGetAuthorizationDetailsResult())
     {
         writer.WriteLine("            GetAuthorizationDetailsResult");
         GetAuthorizationDetailsResult getAuthorizationDetailsResult = response.GetAuthorizationDetailsResult;
         if (getAuthorizationDetailsResult.IsSetAuthorizationDetails())
         {
             writer.WriteLine("                AuthorizationDetails");
             AuthorizationDetails authorizationDetails = getAuthorizationDetailsResult.AuthorizationDetails;
             if (authorizationDetails.IsSetAmazonAuthorizationId())
             {
                 writer.WriteLine("                    AmazonAuthorizationId");
                 writer.WriteLine("                        {0}", authorizationDetails.AmazonAuthorizationId);
             }
             if (authorizationDetails.IsSetAuthorizationReferenceId())
             {
                 writer.WriteLine("                    AuthorizationReferenceId");
                 writer.WriteLine("                        {0}", authorizationDetails.AuthorizationReferenceId);
             }
             if (authorizationDetails.IsSetAuthorizationBillingAddress())
             {
                 writer.WriteLine("                    AuthorizationBillingAddress");
                 Address authorizationBillingAddress = authorizationDetails.AuthorizationBillingAddress;
                 if (authorizationBillingAddress.IsSetName())
                 {
                     writer.WriteLine("                            Name");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.Name);
                 }
                 if (authorizationBillingAddress.IsSetAddressLine1())
                 {
                     writer.WriteLine("                            AddressLine1");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.AddressLine1);
                 }
                 if (authorizationBillingAddress.IsSetAddressLine2())
                 {
                     writer.WriteLine("                            AddressLine2");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.AddressLine2);
                 }
                 if (authorizationBillingAddress.IsSetAddressLine3())
                 {
                     writer.WriteLine("                            AddressLine3");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.AddressLine3);
                 }
                 if (authorizationBillingAddress.IsSetCity())
                 {
                     writer.WriteLine("                            City");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.City);
                 }
                 if (authorizationBillingAddress.IsSetCounty())
                 {
                     writer.WriteLine("                            County");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.County);
                 }
                 if (authorizationBillingAddress.IsSetDistrict())
                 {
                     writer.WriteLine("                            District");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.District);
                 }
                 if (authorizationBillingAddress.IsSetStateOrRegion())
                 {
                     writer.WriteLine("                            StateOrRegion");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.StateOrRegion);
                 }
                 if (authorizationBillingAddress.IsSetPostalCode())
                 {
                     writer.WriteLine("                            PostalCode");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.PostalCode);
                 }
                 if (authorizationBillingAddress.IsSetCountryCode())
                 {
                     writer.WriteLine("                            CountryCode");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.CountryCode);
                 }
                 if (authorizationBillingAddress.IsSetPhone())
                 {
                     writer.WriteLine("                            Phone");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.Phone);
                 }
             }
             if (authorizationDetails.IsSetSellerAuthorizationNote())
             {
                 writer.WriteLine("                    SellerAuthorizationNote");
                 writer.WriteLine("                        {0}", authorizationDetails.SellerAuthorizationNote);
             }
             if (authorizationDetails.IsSetAuthorizationAmount())
             {
                 writer.WriteLine("                    AuthorizationAmount");
                 Price authorizationAmount = authorizationDetails.AuthorizationAmount;
                 if (authorizationAmount.IsSetAmount())
                 {
                     writer.WriteLine("                        Amount");
                     writer.WriteLine("                            {0}", authorizationAmount.Amount);
                 }
                 if (authorizationAmount.IsSetCurrencyCode())
                 {
                     writer.WriteLine("                        CurrencyCode");
                     writer.WriteLine("                            {0}", authorizationAmount.CurrencyCode);
                 }
             }
             if (authorizationDetails.IsSetCapturedAmount())
             {
                 writer.WriteLine("                    CapturedAmount");
                 Price capturedAmount = authorizationDetails.CapturedAmount;
                 if (capturedAmount.IsSetAmount())
                 {
                     writer.WriteLine("                        Amount");
                     writer.WriteLine("                            {0}", capturedAmount.Amount);
                 }
                 if (capturedAmount.IsSetCurrencyCode())
                 {
                     writer.WriteLine("                        CurrencyCode");
                     writer.WriteLine("                            {0}", capturedAmount.CurrencyCode);
                 }
             }
             if (authorizationDetails.IsSetAuthorizationFee())
             {
                 writer.WriteLine("                    AuthorizationFee");
                 Price authorizationFee = authorizationDetails.AuthorizationFee;
                 if (authorizationFee.IsSetAmount())
                 {
                     writer.WriteLine("                        Amount");
                     writer.WriteLine("                            {0}", authorizationFee.Amount);
                 }
                 if (authorizationFee.IsSetCurrencyCode())
                 {
                     writer.WriteLine("                        CurrencyCode");
                     writer.WriteLine("                            {0}", authorizationFee.CurrencyCode);
                 }
             }
             if (authorizationDetails.IsSetCreationTimestamp())
             {
                 writer.WriteLine("                    CreationTimestamp");
                 writer.WriteLine("                        {0}", authorizationDetails.CreationTimestamp);
             }
             if (authorizationDetails.IsSetExpirationTimestamp())
             {
                 writer.WriteLine("                    ExpirationTimestamp");
                 writer.WriteLine("                        {0}", authorizationDetails.ExpirationTimestamp);
             }
             if (authorizationDetails.IsSetAuthorizationStatus())
             {
                 writer.WriteLine("                    AuthorizationStatus");
                 Status authorizationStatus = authorizationDetails.AuthorizationStatus;
                 if (authorizationStatus.IsSetState())
                 {
                     writer.WriteLine("                        State");
                     writer.WriteLine("                            {0}", authorizationStatus.State);
                 }
                 if (authorizationStatus.IsSetLastUpdateTimestamp())
                 {
                     writer.WriteLine("                        LastUpdateTimestamp");
                     writer.WriteLine("                            {0}", authorizationStatus.LastUpdateTimestamp);
                 }
                 if (authorizationStatus.IsSetReasonCode())
                 {
                     writer.WriteLine("                        ReasonCode");
                     writer.WriteLine("                            {0}", authorizationStatus.ReasonCode);
                 }
                 if (authorizationStatus.IsSetReasonDescription())
                 {
                     writer.WriteLine("                        ReasonDescription");
                     writer.WriteLine("                            {0}", authorizationStatus.ReasonDescription);
                 }
                 if (authorizationDetails.IsSetAddressVerificationCode())
                 {
                     writer.WriteLine("                    AddressVerificationCode");
                     writer.WriteLine("                        {0}", authorizationDetails.AddressVerificationCode);
                 }
             }
         }
     }
     if (response.IsSetResponseMetadata())
     {
         writer.WriteLine("            ResponseMetadata");
         ResponseMetadata responseMetadata = response.ResponseMetadata;
         if (responseMetadata.IsSetRequestId())
         {
             writer.WriteLine("                RequestId");
             writer.WriteLine("                    {0}", responseMetadata.RequestId);
         }
     }
 }
 public static void printGetAuthorizationDetailsResponseToBuffer(GetAuthorizationDetailsResponse response, TextWriter writer)
 {
     writer.WriteLine("Service Response");
     writer.WriteLine("=============================================================================");
     writer.WriteLine();
     writer.WriteLine("        GetAuthorizationDetailsResponse");
     if (response.IsSetGetAuthorizationDetailsResult())
     {
         writer.WriteLine("            GetAuthorizationDetailsResult");
         GetAuthorizationDetailsResult getAuthorizationDetailsResult = response.GetAuthorizationDetailsResult;
         if (getAuthorizationDetailsResult.IsSetAuthorizationDetails())
         {
             writer.WriteLine("                AuthorizationDetails");
             AuthorizationDetails authorizationDetails = getAuthorizationDetailsResult.AuthorizationDetails;
             if (authorizationDetails.IsSetAmazonAuthorizationId())
             {
                 writer.WriteLine("                    AmazonAuthorizationId");
                 writer.WriteLine("                        {0}", authorizationDetails.AmazonAuthorizationId);
             }
             if (authorizationDetails.IsSetAuthorizationReferenceId())
             {
                 writer.WriteLine("                    AuthorizationReferenceId");
                 writer.WriteLine("                        {0}", authorizationDetails.AuthorizationReferenceId);
             }
             if (authorizationDetails.IsSetAuthorizationBillingAddress())
             {
                 writer.WriteLine("                    AuthorizationBillingAddress");
                 Address authorizationBillingAddress = authorizationDetails.AuthorizationBillingAddress;
                 if (authorizationBillingAddress.IsSetName())
                 {
                     writer.WriteLine("                            Name");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.Name);
                 }
                 if (authorizationBillingAddress.IsSetAddressLine1())
                 {
                     writer.WriteLine("                            AddressLine1");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.AddressLine1);
                 }
                 if (authorizationBillingAddress.IsSetAddressLine2())
                 {
                     writer.WriteLine("                            AddressLine2");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.AddressLine2);
                 }
                 if (authorizationBillingAddress.IsSetAddressLine3())
                 {
                     writer.WriteLine("                            AddressLine3");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.AddressLine3);
                 }
                 if (authorizationBillingAddress.IsSetCity())
                 {
                     writer.WriteLine("                            City");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.City);
                 }
                 if (authorizationBillingAddress.IsSetCounty())
                 {
                     writer.WriteLine("                            County");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.County);
                 }
                 if (authorizationBillingAddress.IsSetDistrict())
                 {
                     writer.WriteLine("                            District");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.District);
                 }
                 if (authorizationBillingAddress.IsSetStateOrRegion())
                 {
                     writer.WriteLine("                            StateOrRegion");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.StateOrRegion);
                 }
                 if (authorizationBillingAddress.IsSetPostalCode())
                 {
                     writer.WriteLine("                            PostalCode");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.PostalCode);
                 }
                 if (authorizationBillingAddress.IsSetCountryCode())
                 {
                     writer.WriteLine("                            CountryCode");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.CountryCode);
                 }
                 if (authorizationBillingAddress.IsSetPhone())
                 {
                     writer.WriteLine("                            Phone");
                     writer.WriteLine("                                {0}", authorizationBillingAddress.Phone);
                 }
             }
             if (authorizationDetails.IsSetSellerAuthorizationNote())
             {
                 writer.WriteLine("                    SellerAuthorizationNote");
                 writer.WriteLine("                        {0}", authorizationDetails.SellerAuthorizationNote);
             }
             if (authorizationDetails.IsSetAuthorizationAmount())
             {
                 writer.WriteLine("                    AuthorizationAmount");
                 Price authorizationAmount = authorizationDetails.AuthorizationAmount;
                 if (authorizationAmount.IsSetAmount())
                 {
                     writer.WriteLine("                        Amount");
                     writer.WriteLine("                            {0}", authorizationAmount.Amount);
                 }
                 if (authorizationAmount.IsSetCurrencyCode())
                 {
                     writer.WriteLine("                        CurrencyCode");
                     writer.WriteLine("                            {0}", authorizationAmount.CurrencyCode);
                 }
             }
             if (authorizationDetails.IsSetCapturedAmount())
             {
                 writer.WriteLine("                    CapturedAmount");
                 Price capturedAmount = authorizationDetails.CapturedAmount;
                 if (capturedAmount.IsSetAmount())
                 {
                     writer.WriteLine("                        Amount");
                     writer.WriteLine("                            {0}", capturedAmount.Amount);
                 }
                 if (capturedAmount.IsSetCurrencyCode())
                 {
                     writer.WriteLine("                        CurrencyCode");
                     writer.WriteLine("                            {0}", capturedAmount.CurrencyCode);
                 }
             }
             if (authorizationDetails.IsSetAuthorizationFee())
             {
                 writer.WriteLine("                    AuthorizationFee");
                 Price authorizationFee = authorizationDetails.AuthorizationFee;
                 if (authorizationFee.IsSetAmount())
                 {
                     writer.WriteLine("                        Amount");
                     writer.WriteLine("                            {0}", authorizationFee.Amount);
                 }
                 if (authorizationFee.IsSetCurrencyCode())
                 {
                     writer.WriteLine("                        CurrencyCode");
                     writer.WriteLine("                            {0}", authorizationFee.CurrencyCode);
                 }
             }
             if (authorizationDetails.IsSetCreationTimestamp())
             {
                 writer.WriteLine("                    CreationTimestamp");
                 writer.WriteLine("                        {0}", authorizationDetails.CreationTimestamp);
             }
             if (authorizationDetails.IsSetExpirationTimestamp())
             {
                 writer.WriteLine("                    ExpirationTimestamp");
                 writer.WriteLine("                        {0}", authorizationDetails.ExpirationTimestamp);
             }
             if (authorizationDetails.IsSetAuthorizationStatus())
             {
                 writer.WriteLine("                    AuthorizationStatus");
                 Status authorizationStatus = authorizationDetails.AuthorizationStatus;
                 if (authorizationStatus.IsSetState())
                 {
                     writer.WriteLine("                        State");
                     writer.WriteLine("                            {0}", authorizationStatus.State);
                 }
                 if (authorizationStatus.IsSetLastUpdateTimestamp())
                 {
                     writer.WriteLine("                        LastUpdateTimestamp");
                     writer.WriteLine("                            {0}", authorizationStatus.LastUpdateTimestamp);
                 }
                 if (authorizationStatus.IsSetReasonCode())
                 {
                     writer.WriteLine("                        ReasonCode");
                     writer.WriteLine("                            {0}", authorizationStatus.ReasonCode);
                 }
                 if (authorizationStatus.IsSetReasonDescription())
                 {
                     writer.WriteLine("                        ReasonDescription");
                     writer.WriteLine("                            {0}", authorizationStatus.ReasonDescription);
                 }
                 if (authorizationDetails.IsSetAddressVerificationCode())
                 {
                     writer.WriteLine("                    AddressVerificationCode");
                     writer.WriteLine("                        {0}", authorizationDetails.AddressVerificationCode);
                 }
             }
         }
     }
     if (response.IsSetResponseMetadata())
     {
         writer.WriteLine("            ResponseMetadata");
         ResponseMetadata responseMetadata = response.ResponseMetadata;
         if (responseMetadata.IsSetRequestId())
         {
             writer.WriteLine("                RequestId");
             writer.WriteLine("                    {0}", responseMetadata.RequestId);
         }
     }
 }