๐Ÿ–ฅ๏ธ

Real incidents need a real screen.

Open senioreng.dev on your laptop for the full experience.

Pull Request #4677

Add real-time shipping estimates at checkout

Integrates the ShipFast external API to fetch real-time delivery estimates. Called synchronously from CheckoutService before order completion.

Ready to merge
client/ShippingClient.java+31 additions
Viewed
1
+ @Component
2
+ public class ShippingClient {
3
+ private final HttpClient httpClient;
4
+
5
+ public ShippingClient() {
6
+ this.httpClient = HttpClient.newHttpClient();
7
+ }
8
+
9
+ public ShippingEstimate getEstimate(String origin, String destination) {
10
+ HttpRequest request = HttpRequest.newBuilder()
11
+ .uri(URI.create("https://api.shipfast.io/estimate"))
12
+ .header("Authorization", "Bearer " + API_KEY)
13
+ .POST(BodyPublishers.ofString(buildPayload(origin, destination)))
14
+ .build();
15
+ HttpResponse<String> response = httpClient.send(request,
16
+ BodyHandlers.ofString());
17
+ return parseResponse(response.body());
18
+ }
19
+ }
NL

nidhi_lead

Approved review

API responses are fast on staging. Clean integration. LGTM.