public async Task <CreateOrderResModel> CreateOrder([FromBody] CreateOrderReqModel model) { var order = _mapper.Map <CreateOrderReqModel, Order>(model); order.UserId = User.GetAccountId().Value; return(await _orderService.CreateOrderAsync(order)); }
public void CreateOrder() { Shipper shipper = new Shipper() { shipper_name = "易酷", shipper_countrycode = "CN", shipper_street = "福建省莆田市工业园", shipper_telephone = "18650805022", shipper_mobile = "18650805022" }; Consignee consignee = new Consignee() { consignee_name = "Marie Denise Medard Francois", /// <summary> /// 收件人国家二字代码 /// </summary> consignee_countrycode = "US", /// <summary> /// 收件人省 /// </summary> consignee_province = "US-FL", /// <summary> /// 收件人城市 /// </summary> consignee_city = "Mattapan", /// <summary> /// 收件人地址 /// </summary> consignee_street = "760 Cummins HWY Apt11", /// <summary> /// 收件人邮编 /// </summary> consignee_postcode = "02126", /// <summary> /// 收件人电话 /// </summary> consignee_telephone = "862-235-2637", /// <summary> /// 收件人手机 /// </summary> consignee_mobile = "", /// <summary> /// 税号 /// </summary> consignee_tariff = "", }; List <Invoice> invoiceList = new List <Invoice>(); Invoice invoice = new Invoice(); invoice.invoice_enname = "Dresses"; invoice.invoice_cnname = "是否是"; invoice.invoice_quantity = "1"; invoice.invoice_unitcharge = "2.34"; invoice.consignee_street = "760 Cummins HWY Apt11"; invoice.consignee_postcode = "02126"; invoiceList.Add(invoice); var start = consignee.consignee_province.IndexOf("-") + 1; var cons = consignee.consignee_province.Substring(start); CreateOrderReqModel model = new CreateOrderReqModel() { reference_no = "LB20121891902", shipping_method = "EUBYD", order_weight = "10", consignee = consignee, shipper = shipper, invoice = invoiceList }; CreateOrderReq req = new CreateOrderReq(model); YDHClient yDHClient = new YDHClient(); var response = yDHClient.PostRequestAsync(req); Assert.Equal(true, 1 > 0); }