Example #1
0
        public OrderReferenceDetails SetOrderReferenceDetails(AmazonPayClient client, string orderReferenceId, decimal?orderTotalAmount,
                                                              string currencyCode, string orderGuid = null, string storeName = null)
        {
            var request = new SetOrderReferenceDetailsRequest();

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

            var attributes = new OrderReferenceAttributes();

            //attributes.SellerNote = client.Settings.SellerNoteOrderReference.Truncate(1024);
            attributes.PlatformId = AmazonPayCore.PlatformId;

            if (orderTotalAmount.HasValue)
            {
                attributes.OrderTotal = new OrderTotal()
                {
                    Amount       = orderTotalAmount.Value.ToString("0.00", CultureInfo.InvariantCulture),
                    CurrencyCode = currencyCode
                };
            }

            if (orderGuid.HasValue())
            {
                attributes.SellerOrderAttributes = new SellerOrderAttributes()
                {
                    SellerOrderId = orderGuid,
                    StoreName     = storeName
                };
            }

            request.OrderReferenceAttributes = attributes;

            var response = client.Service.SetOrderReferenceDetails(request);

            if (response != null && response.IsSetSetOrderReferenceDetailsResult())
            {
                var detailsResult = response.SetOrderReferenceDetailsResult;

                if (detailsResult.IsSetOrderReferenceDetails())
                {
                    return(detailsResult.OrderReferenceDetails);
                }
            }
            return(null);
        }
        public static SetOrderReferenceDetailsResponse SetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
                                                                                IOffAmazonPaymentsService service, string orderReferenceId, string orderAmount)
        {
            SetOrderReferenceDetailsRequest setOrderRequest = new SetOrderReferenceDetailsRequest();

            setOrderRequest.SellerId = propertiesCollection.MerchantID;
            setOrderRequest.AmazonOrderReferenceId = orderReferenceId;
            //setup the currency and amount as an ordertotal object
            OrderReferenceAttributes attributes = new OrderReferenceAttributes();
            OrderTotal orderTotal = new OrderTotal();

            orderTotal.Amount       = orderAmount;
            orderTotal.CurrencyCode = propertiesCollection.CurrencyCode;
            attributes.OrderTotal   = orderTotal;
            setOrderRequest.OrderReferenceAttributes = attributes;
            return(SetOrderReferenceDetailsSample.InvokeSetOrderReferenceDetails(service, setOrderRequest));
        }
        public OrderReferenceDetails SetOrderReferenceDetails(AmazonPayClient client, string orderReferenceId, decimal? orderTotalAmount,
			string currencyCode, string orderGuid = null, string storeName = null)
        {
            var request = new SetOrderReferenceDetailsRequest();
            request.SellerId = client.Settings.SellerId;
            request.AmazonOrderReferenceId = orderReferenceId;

            var attributes = new OrderReferenceAttributes();
            //attributes.SellerNote = client.Settings.SellerNoteOrderReference.Truncate(1024);
            attributes.PlatformId = AmazonPayCore.PlatformId;

            if (orderTotalAmount.HasValue)
            {
                attributes.OrderTotal = new OrderTotal()
                {
                    Amount = orderTotalAmount.Value.ToString("0.00", CultureInfo.InvariantCulture),
                    CurrencyCode = currencyCode
                };
            }

            if (orderGuid.HasValue())
            {
                attributes.SellerOrderAttributes = new SellerOrderAttributes()
                {
                    SellerOrderId = orderGuid,
                    StoreName = storeName
                };
            }

            request.OrderReferenceAttributes = attributes;

            var response = client.Service.SetOrderReferenceDetails(request);

            if (response != null && response.IsSetSetOrderReferenceDetailsResult())
            {
                var detailsResult = response.SetOrderReferenceDetailsResult;

                if (detailsResult.IsSetOrderReferenceDetails())
                    return detailsResult.OrderReferenceDetails;
            }
            return null;
        }
 public static SetOrderReferenceDetailsResponse SetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, 
     IOffAmazonPaymentsService service, string orderReferenceId, string orderAmount)
 {
     SetOrderReferenceDetailsRequest setOrderRequest = new SetOrderReferenceDetailsRequest();
     setOrderRequest.SellerId = propertiesCollection.MerchantID;
     setOrderRequest.AmazonOrderReferenceId = orderReferenceId;
     //setup the currency and amount as an ordertotal object
     OrderReferenceAttributes attributes = new OrderReferenceAttributes();
     OrderTotal orderTotal = new OrderTotal();
     orderTotal.Amount = orderAmount;
     orderTotal.CurrencyCode = propertiesCollection.CurrencyCode;
     attributes.OrderTotal = orderTotal;
     setOrderRequest.OrderReferenceAttributes = attributes;
     return SetOrderReferenceDetailsSample.InvokeSetOrderReferenceDetails(service, setOrderRequest);
 }