Business Logic
A typical CWE pickup request looks like this:
Pickup Data |
Returned Data |
Sender ID Shipment number Pickup address Requested pickup time Destination address Tax number Package type |
Transaction number Scheduled pickup time Subtotal Tax Description (used for special shipping instructions) |
Euro-Ship's pickup request looks like this:
Pickup Data |
Returned Data |
Sender ID Pickup address Requested pickup time Destination address Tax system code Tax number Package type |
Transaction number Shipment number Scheduled pickup time Subtotal Tax |
The idea is that one company will pick up the package, and the other will deliver it, so the delivery data must arrive in the other company's database somehow. Representatives from each company discuss these issues but cannot agree on a single system for both companies. CWE's system is already written as a web site connected to Enterprise Java Beans (EJB). This system just needs to be adapted to become a web service. But CWE's system doesn't cover Euro-Ship's basic needs. Having two different systems means that the data needs to be converted from one system to the other. The rules used to convert from one format to the other depend on the direction of the shipment.
From the USA to Europe:
CWE Data |
→Euro-Ship Data |
Sender ID |
Sender ID |
Pickup address |
Pickup address |
Requested pickup time |
Requested pickup time |
Destination address |
Destination address |
|
Tax system code = 1 |
Tax number |
Tax number |
Package type |
Package type |
Shipment number |
USA package number (new field) |
The return values for the Euro-Ship pickup operation are then treated this way:
CWE Returned Data |
←Euro-Ship Returned Data |
Ignored |
Transaction number |
Ignored |
Scheduled pickup time (empty) |
Added to the Subtotal field |
Subtotal |
Added to the Tax field |
Tax |
Appended to the Description field |
Shipment number |
From Europe to the USA:
Euro-Ship Data |
→CWE Data |
Sender ID |
Sender ID |
Pickup address |
Pickup address |
Requested pickup time |
Requested pickup time |
Destination address |
Destination address |
Tax system code = 1 |
(Ignored) |
Tax number |
Tax number |
Package type |
Package type |
USA package number (empty) |
Shipment number (generated) |
Shipment number |
(Ignored) |
The return values for the CWE pickup operation are then processed this way:
Euro-Ship Returned Data |
←CWE Returned Data |
Ignored |
Transaction number |
Ignored |
Scheduled pickup time (empty) |
Added to the Subtotal field |
Subtotal |
Added to the Tax field |
Tax |
Ignored |
Description |
Processing a pickup request is processed in the following way:
Receive the request through SOAP.
If the package is to be picked up from another continent, store the request and return the response message. But don't pick up the package! The other company will take care of it.
If the package is going to another continent (say, from the USA to Europe), transform the request using the rules above and forward it to the other system. Wait for the result message.
Schedule a pickup and return the response message.
A European package destined to the United States will have the word USA in the destination address. An American package destined for Europe will have a USA package number.
Those are the business rules for developing our system.