示例#1
0
        private static void RunSample()
        {
            CancelOrderReferenceResponse response = instance.CancelOrderReference(orderReferenceId);

            if (response == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from the CancelOrderReference request is null");
            }
        }
示例#2
0
        private void RunSample(string orderReferenceId, string orderAmount, OffAmazonPaymentsServiceSimpleCheckout instance)
        {
            /************************************************************************
             * Invoke Set Order Reference Details Action
             ***********************************************************************/
            SetOrderReferenceDetailsResponse setOrderDetailsResponse = instance.SetOrderReferenceDetails(orderAmount);

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

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

            /************************************************************************
             * Invoke Authorize Action
             ***********************************************************************/
            AuthorizeResponse authResponse = instance.AuthorizeAction(setOrderDetailsResponse, 1);

            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 += WaitAndGetNotificationDetails(authResponse.AuthorizeResult.AuthorizationDetails.AmazonAuthorizationId + "_Authorize");

            instance.CheckAuthorizationStatus(authResponse);

            OffAmazonPaymentsServiceCancellation cancelInstance = new OffAmazonPaymentsServiceCancellation();

            /************************************************************************
             * Invoke Cancel Order Reference Action
             ***********************************************************************/
            CancelOrderReferenceResponse cancelResponse = cancelInstance.CancelOrderReference(orderReferenceId);

            if (cancelResponse == null)
            {
                throw new OffAmazonPaymentsServiceException("The response from the CancelOrderReference request is null");
            }
        }