You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.4 KiB
C#

using System.Collections.Generic;
using TradeManageNew.APIClients.FedexAPI.Models.Ship;
namespace TradeManageNew.APIClients.FedexAPI.Tests
{
public class ShipTests : TestBase
{
public void Should_CreateShipmentAsync()
{
var client = GetClient();
var parameter = new CreateShipmentReq
{
LabelResponseOptions = LABELRESPONSEOPTIONS.URL_ONLY,
RequestedShipment = new RequestedShipment()
{
Shipper = new ShipperParty()
{
Contact = new PartyContact()
{
PersonName = "Jacksonville",
PhoneNumber = "9045971260"
},
Address = new PartyAddress_2()
{
StreetLines = new List<string>()
{
"2615 port industrial Dr. suites 408"
},
City = "Jacksonville",
StateOrProvinceCode = "FL",
PostalCode = "32226",
CountryCode = "US"
}
},
Recipients = new List<RecipientsParty>()
{
new RecipientsParty()
{
Contact = new PartyContact()
{
PersonName = "Bradford Price",
PhoneNumber = "+1 415-419-8616",
CompanyName = "Bradford Price"
},
Address = new PartyAddress_2()
{
StreetLines = new List<string>()
{
"250 MCINTOSH"
},
City = "SAINT SIMONS ISLAND",
StateOrProvinceCode = "GA",
PostalCode = "31522-1867",
CountryCode = "US"
}
}
},
//ShipDatestamp =
ServiceType = RequestedShipmentServiceType.PRIORITY_OVERNIGHT,
PackagingType = RequestedShipmentPackageType.FEDEX_ENVELOPE,
PickupType = RequestedShipmentPickupType.USE_SCHEDULED_PICKUP,
BlockInsightVisibility = false,
ShippingChargesPayment = new Payment()
{
PaymentType = PaymentType.SENDER
},
ShipmentSpecialServices = new ShipmentSpecialServicesRequested()
{
SpecialServiceTypes = new List<RequestedShipmentSpecialServiceType>()
{
RequestedShipmentSpecialServiceType.RETURN_SHIPMENT
},
ReturnShipmentDetail = new ReturnShipmentDetail
{
ReturnType = ReturnShipmentDetailReturnType.PRINT_RETURN_LABEL
}
},
LabelSpecification = new LabelSpecification()
{
ImageType = LabelSpecificationImageType.PDF,
LabelStockType = LabelSpecificationLabelStockType.PAPER_85X11_TOP_HALF_LABEL
},
RequestedPackageLineItems = new List<RequestedPackageLineItem>()
{
new RequestedPackageLineItem()
{
Weight = new Weight()
{
Value = 1,
Units = WeightUnits.LB
}
}
}
},
AccountNumber = new ShipperAccountNumber()
{
Value = client.Credential.AccountNumber
}
};
var response = client.Ship.CreateShipmentAsync(parameter)
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
}
}
}