public static ConfirmOrderReferenceResponse InvokeConfirmOrderReference(IOffAmazonPaymentsService service, ConfirmOrderReferenceRequest request)
        {
            ConfirmOrderReferenceResponse response = null;
            try
            {
                response = service.ConfirmOrderReference(request);
                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();
                Console.WriteLine("        ConfirmOrderReferenceResponse");
                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;
        }
Exemplo n.º 2
0
        /// <summary>Confirm an order reference informs Amazon that the buyer has placed the order.</summary>
        public void ConfirmOrderReference(AmazonPayClient client, string orderReferenceId)
        {
            var request = new ConfirmOrderReferenceRequest();

            request.SellerId = client.Settings.SellerId;
            request.AmazonOrderReferenceId = orderReferenceId;

            var response = client.Service.ConfirmOrderReference(request);
        }
        public static ConfirmOrderReferenceResponse ConfirmOrderReferenceObject(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
            IOffAmazonPaymentsService service, string orderReferenceId)
        {
            ConfirmOrderReferenceRequest confirmOrderRequest = new ConfirmOrderReferenceRequest();
            confirmOrderRequest.SellerId = propertiesCollection.MerchantID;
            confirmOrderRequest.AmazonOrderReferenceId = orderReferenceId;

            return ConfirmOrderReferenceSample.InvokeConfirmOrderReference(service, confirmOrderRequest);
        }
Exemplo n.º 4
0
        public void ConfirmOrderReferenceApiCall()
        {
            ConfirmOrderReferenceRequest getRequestParameters = new ConfirmOrderReferenceRequest();

            getRequestParameters.WithAmazonOrderReferenceId(Session["amazonOrderReferenceId"].ToString());

            ConfirmOrderReferenceResponse confirmOrderReferenceResponse = client.ConfirmOrderReference(getRequestParameters);

            confirm.InnerHtml = confirmOrderReferenceResponse.GetJson();
        }
Exemplo n.º 5
0
        public static ConfirmOrderReferenceResponse ConfirmOrderReferenceObject(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
                                                                                IOffAmazonPaymentsService service, string orderReferenceId)
        {
            ConfirmOrderReferenceRequest confirmOrderRequest = new ConfirmOrderReferenceRequest();

            confirmOrderRequest.SellerId = propertiesCollection.MerchantID;
            confirmOrderRequest.AmazonOrderReferenceId = orderReferenceId;

            return(ConfirmOrderReferenceSample.InvokeConfirmOrderReference(service, confirmOrderRequest));
        }
Exemplo n.º 6
0
        public IActionResult ConfirmAndAuthorize()
        {
            var session          = _httpContextAccessor.HttpContext.Session;
            var orderReferenceId = session.Get <string>(AmazonOrderReferenceId);
            var amount           = session.Get <decimal>(AmazonOrderAmount);

            var getRequestParameters = new ConfirmOrderReferenceRequest();

            getRequestParameters.WithAmazonOrderReferenceId(orderReferenceId);



            var response = (IResponse)AmazonClient.ConfirmOrderReference(getRequestParameters);

            if (response.GetSuccess())
            {
                var uniqueReferenceId = GenerateRandomUniqueString();
                var currencyCode      = (Regions.currencyCode)Enum.Parse(typeof(Regions.currencyCode), _config.CurrencyCode);

                AuthorizeRequest authRequestParameters = new AuthorizeRequest();
                authRequestParameters.WithAmazonOrderReferenceId(orderReferenceId)
                .WithAmount(amount)
                .WithCurrencyCode(currencyCode)
                .WithAuthorizationReferenceId(uniqueReferenceId)
                .WithTransactionTimeout(0)
                .WithCaptureNow(true)
                .WithSellerAuthorizationNote("Note");

                response = AmazonClient.Authorize(authRequestParameters);
                var orderDetails = AmazonClient.GetOrderReferenceDetails(new GetOrderReferenceDetailsRequest()
                                                                         .WithAmazonOrderReferenceId(orderReferenceId));

                var jsonString = new StringBuilder(response.GetJson());
                //jsonString.AppendLine(orderDetails.GetJson());
                //jsonString.AppendLine("}");


                var data = JsonConvert.DeserializeObject <dynamic>(jsonString.ToString());

                return(Json(data));
            }

            return(Json(JsonConvert.DeserializeObject <dynamic>(response.GetJson())));
        }
Exemplo n.º 7
0
        public ActionResult ConfirmOrder()
        {
            ConfirmOrderReferenceRequest getRequestParameters = new ConfirmOrderReferenceRequest();

            getRequestParameters.WithAmazonOrderReferenceId(Session["amazonOrderReferenceId"].ToString());
            var amazonOrderReferenceId = Session["amazonOrderReferenceId"].ToString();

            ConfirmOrderReferenceResponse confirmOrderReferenceResponse = client.ConfirmOrderReference(getRequestParameters);

            if (!confirmOrderReferenceResponse.GetSuccess())
            {
                apiResponse["confirmOrderReferenceResponse"] = "SetOrderReferenceDetails API call Failed" + Environment.NewLine + confirmOrderReferenceResponse.GetJson();
            }
            else
            {
                apiResponse["confirmOrderReferenceResponse"] = confirmOrderReferenceResponse.GetJson();
            }
            return(Json(apiResponse));
        }
Exemplo n.º 8
0
        /// <summary>Confirm an order reference informs Amazon that the buyer has placed the order.</summary>
        public void ConfirmOrderReference(AmazonPayClient client, string orderReferenceId)
        {
            var request = new ConfirmOrderReferenceRequest();
            request.SellerId = client.Settings.SellerId;
            request.AmazonOrderReferenceId = orderReferenceId;

            var response = client.Service.ConfirmOrderReference(request);
        }
        public void ConfirmOrderReferenceApiCall()
        {
            ConfirmOrderReferenceRequest getRequestParameters = new ConfirmOrderReferenceRequest();
            getRequestParameters.WithAmazonOrderReferenceId(Session["amazonOrderReferenceId"].ToString());

            ConfirmOrderReferenceResponse confirmOrderReferenceResponse = client.ConfirmOrderReference(getRequestParameters);
            confirm.InnerHtml = confirmOrderReferenceResponse.GetJson();
        }
Exemplo n.º 10
0
        public static ConfirmOrderReferenceResponse InvokeConfirmOrderReference(IOffAmazonPaymentsService service, ConfirmOrderReferenceRequest request)
        {
            ConfirmOrderReferenceResponse response = null;

            try
            {
                response = service.ConfirmOrderReference(request);
                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();
                Console.WriteLine("        ConfirmOrderReferenceResponse");
                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);
        }