public void OrderApi_CreateOrder() { OrdersApi api = new OrdersApi(BaseUrl, apiToken, apiKey); CreateOrdersRequest req = new CreateOrdersRequest(); req.Amount = new AmountsCreateOrdersRequest() { Currency = CurrencyType.BRL, Subtotals = new TotaisAmountsCreateOrdersRequest() { Shipping = 0 } }; string idCliente = "CUS-1IO9IR204YI4"; req.Customer = new ClienteCreateOrdersRequest(idCliente); req.Items = new System.Collections.Generic.List <OrderItemCreateOrdersRequest>(); req.Items.Add(new OrderItemCreateOrdersRequest() { Detail = "Detalhe Produto de teste ", Price = 100, Product = "Produto de teste ", Quantity = 1 }); req.OwnId = "231"; req.Receivers = new System.Collections.Generic.List <ReceiverCreateOrdersRequest>(); req.Receivers.Add(new ReceiverCreateOrdersRequest() { Type = ReceiverType.PRIMARY, Amount = new AmountReceiverCreateOrdersRequest() { Percentual = 1, ValueFixed = 1 }, FeePayor = false, moipAccount = new MoipAccountReceiverCreateOrdersRequest() { Id = "MPA-9B34B54E286C" } }); var retorno = api.CreateOrder(req); }
/// <summary> /// Create the given list of proposals /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/proposals/insert /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated AdExchangeBuyer service.</param> /// <param name="body">A valid AdExchangeBuyer v1.4 body.</param> /// <returns>CreateOrdersResponseResponse</returns> public static CreateOrdersResponse Insert(AdExchangeBuyerService service, CreateOrdersRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Proposals.Insert(body).Execute()); } catch (Exception ex) { throw new Exception("Request Proposals.Insert failed.", ex); } }