It is a Web Service integration prepared for the Yurtiçi Kargo.
The package was written in Java version 1.8
First of all, download Yurtici-Kargo.jar and add dependency for your project.
- Create Shipment
- Cancel Shipment
- Query Shipment
AuthShipmentRequest authShipmentRequest = new AuthShipmentRequest();
authShipmentRequest.setWsUserName("XXX");
authShipmentRequest.setWsPassword("XXX");
authShipmentRequest.setUserLanguage("TR");
authShipmentRequest.setWsLanguage("TR");
//initialize service
ShipmentService shipmentService = new ShipmentService(authShipmentRequest);
//a new shipment
ShippingOrderVO shippingOrderVO = new ShippingOrderVO();
shippingOrderVO.setReceiverCustName("Ali Baran Eser");
shippingOrderVO.setReceiverAddress("Lorem ipsum dolar sit amet");
shippingOrderVO.setReceiverPhone1("XXXXXXXXXXXX");
shippingOrderVO.setCargoKey("BARCODE_KEY");
shippingOrderVO.setInvoiceKey("INVOCE_KEY");
shippingOrderVO.setDescription("Lorem ipsum dolar sit amet");
shippingOrderVO.setCityName("İzmir");
shippingOrderVO.setTownName("Konak");
shippingOrderVO.setCargoCount(1);
ShippingOrderDoorPayment shipingOrderDoorPayment = new ShippingOrderDoorPayment();
shipingOrderDoorPayment.setTtDocumentId(ANY_DIGIT_NUMBER);
shipingOrderDoorPayment.setTtInvoiceAmount(AMOUNT);
shipingOrderDoorPayment.setTtCollectionType(0);
shipingOrderDoorPayment.setTtDocumentSaveType(0);
shippingOrderVO.setShippingOrderDoorPayment(shipingOrderDoorPayment);
ShippingOrderDoorPaymentCC shipingOrderDoorPaymentCC = new ShippingOrderDoorPaymentCC();
shipingOrderDoorPaymentCC.setTtDocumentId( orderCargoSummary.getOrderNo());
shipingOrderDoorPaymentCC.setTtInvoiceAmount( orderCargoSummary.getTotalPrice());
shipingOrderDoorPaymentCC.setTtCollectionType(1);
shipingOrderDoorPaymentCC.setDcCreditRule(1);
shipingOrderDoorPaymentCC.setDcSelectedCredit(1);
shipingOrderDoorPaymentCC.setTtDocumentSaveType(0);
shippingOrderVO.setShippingOrderDoorPayment(shipingOrderDoorPayment);
Choose type of shipment
public enum ShipmentType {
STANDART,
PAYMENT_DOOR,
PAYMENT_DOOR_CC
}
Send Request to API
shipmentService.createShipment(shippingOrderVO, ShipmentType.STANDART);
List<String> cargoKeys = new ArrayList<>();
cargoKeys.add("BARCODE1");
cargoKeys.add("BARCODE2");
shipmentService.cancelShipment(cargoKeys);
List<String> cargoKeys = new ArrayList<>();
cargoKeys.add("BARCODE1");
cargoKeys.add("BARCODE2");
shipmentService.queryShipment(cargoKeys);
Note: You can view examples of services in examples folder.