/** * AUTO_GENERATED */ public UpdateInvoiceResponse UpdateInvoice(UpdateInvoiceRequest updateInvoiceRequest, string apiUserName) { string response = Call("UpdateInvoice", updateInvoiceRequest.ToNVPString(""), apiUserName); NVPUtil util = new NVPUtil(); return(UpdateInvoiceResponse.CreateInstance(util.ParseNVPString(response), "", -1)); }
public void UpdateInvoice() { UpdateInvoiceSample sample = new UpdateInvoiceSample(); UpdateInvoiceResponse responseUpdateInvoice = sample.UpdateInvoiceAPIOperation(); Assert.IsNotNull(responseUpdateInvoice); Assert.AreEqual(responseUpdateInvoice.responseEnvelope.ack.ToString().Trim().ToUpper(), "SUCCESS"); }
public async Task <IActionResult> Put(int id, [FromBody] UpdateInvoiceRequest request) { request.ID = id; UpdateInvoiceResponse result = await _InvoiceAppService.updateInvoice(request); if (result.Success) { return(Ok(result)); } return(NotFound(result)); }
/// <summary> /// /// </summary> ///<param name="updateInvoiceRequest"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public UpdateInvoiceResponse UpdateInvoice(UpdateInvoiceRequest updateInvoiceRequest, ICredential credential) { IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, updateInvoiceRequest.ToNVPString(string.Empty), ServiceName, "UpdateInvoice", credential); ((PlatformAPICallPreHandler)apiCallPreHandler).SDKName = SDKName; ((PlatformAPICallPreHandler)apiCallPreHandler).SDKVersion = SDKVersion; ((PlatformAPICallPreHandler)apiCallPreHandler).PortName = "Invoice"; NVPUtil util = new NVPUtil(); return(UpdateInvoiceResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1)); }
public Task <UpdateInvoiceResponse> updateInvoice(UpdateInvoiceRequest request) { List <InvoiceItem> items = new List <InvoiceItem>(); int totalPrice = 0; decimal totalWeight = 0; foreach (InvoiceItemModel invoiceItem in request.Items) { totalPrice += invoiceItem.TotalPrice; decimal weightPerUnit = _ProductRepository.GetWeightPerUnit(invoiceItem.ProductID, invoiceItem.UnitID); invoiceItem.Weight = weightPerUnit * invoiceItem.Quantity; totalWeight += invoiceItem.Weight; } UpdateInvoiceCommand command = new UpdateInvoiceCommand() { ID = request.ID, Address = request.Address, CustomerCode = request.CustomerCode, CustomerID = request.CustomerID, CustomerName = request.CustomerName, TotalPrice = totalPrice, WeightTotal = totalWeight, Note = request.Note, Code = request.Code, Items = request.Items }; Task <object> Invoice = (Task <object>)Bus.SendCommand(command); RabbitMQBus.Publish(command); UpdateInvoiceResponse response = new UpdateInvoiceResponse(); response = Common <UpdateInvoiceResponse> .checkHasNotification(_notifications, response); response.OK = response.Success; response.Content = ""; return(Task.FromResult(response)); }
// # UpdateInvoice API Operation // Use the UpdateInvoice API operation to update an invoice. public UpdateInvoiceResponse UpdateInvoiceAPIOperation() { // Create the UpdateInvoiceResponse object UpdateInvoiceResponse responseUpdateInvoice = new UpdateInvoiceResponse(); try { // # UpdateInvoiceRequest // Use the UpdateInvoiceRequest message to update an invoice. // The code for the language in which errors are returned, which must be // en_US. RequestEnvelope envelopeRequest = new RequestEnvelope(); envelopeRequest.errorLanguage = "en_US"; List <InvoiceItemType> invoiceItemList = new List <InvoiceItemType>(); // InvoiceItemType which takes mandatory params: // // * `Item Name` - SKU or name of the item. // * `Quantity` - Item count. // * `Amount` - Price of the item, in the currency specified by the // invoice. InvoiceItemType invoiceItem = new InvoiceItemType("Item", Convert.ToDecimal("2"), Convert.ToDecimal("4.00")); invoiceItemList.Add(invoiceItem); // Invoice item. InvoiceItemListType itemList = new InvoiceItemListType(invoiceItemList); // InvoiceType which takes mandatory params: // // * `Merchant Email` - Merchant email address. // * `Personal Email` - Payer email address. // * `InvoiceItemList` - List of items included in this invoice. // * `CurrencyCode` - Currency used for all invoice item amounts and // totals. // * `PaymentTerms` - Terms by which the invoice payment is due. It is // one of the following values: // * DueOnReceipt - Payment is due when the payer receives the invoice. // * DueOnDateSpecified - Payment is due on the date specified in the // invoice. // * Net10 - Payment is due 10 days from the invoice date. // * Net15 - Payment is due 15 days from the invoice date. // * Net30 - Payment is due 30 days from the invoice date. // * Net45 - Payment is due 45 days from the invoice date. InvoiceType invoice = new InvoiceType("*****@*****.**", "*****@*****.**", itemList, "USD", PaymentTermsType.DUEONRECEIPT); // UpdateInvoiceRequest which takes mandatory params: // // * `Request Envelope` - Information common to each API operation, such // as the language in which an error message is returned. // * `Invoice ID` - ID of the invoice to update. // * `Invoice` - Merchant, payer, and invoice information. UpdateInvoiceRequest requestUpdateInvoice = new UpdateInvoiceRequest(envelopeRequest, "INV2-ZC9R-X6MS-RK8H-4VKJ", invoice); // Create the service wrapper object to make the API call InvoiceService service = new InvoiceService(); // # API call // Invoke the UpdateInvoice method in service responseUpdateInvoice = service.UpdateInvoice(requestUpdateInvoice); if (responseUpdateInvoice != null) { // Response envelope acknowledgement string acknowledgement = "UpdateInvoice API Operation - "; acknowledgement += responseUpdateInvoice.responseEnvelope.ack.ToString(); logger.Info(acknowledgement + "\n"); Console.WriteLine(acknowledgement + "\n"); // # Success values if (responseUpdateInvoice.responseEnvelope.ack.ToString().Trim().ToUpper().Equals("SUCCESS")) { // ID of the created invoice. logger.Info("Invoice ID : " + responseUpdateInvoice.invoiceID + "\n"); Console.WriteLine("Invoice ID : " + responseUpdateInvoice.invoiceID + "\n"); } // # Error Values else { List <ErrorData> errorMessages = responseUpdateInvoice.error; foreach (ErrorData error in errorMessages) { logger.Debug("API Error Message : " + error.message + "\n"); Console.WriteLine("API Error Message : " + error.message + "\n"); } } } } // # Exception log catch (System.Exception ex) { // Log the exception message logger.Debug("Error Message : " + ex.Message); Console.WriteLine("Error Message : " + ex.Message); } return(responseUpdateInvoice); }