--- lib/features/delivery_module/order/domain/repositories/order_repository.dart.bak-gpsgate	2026-05-30 09:07:14.954019493 +0000
+++ lib/features/delivery_module/order/domain/repositories/order_repository.dart	2026-05-30 09:07:30.107845686 +0000
@@ -81,6 +81,19 @@
 
     Map<String, String> data;
 
+    // d50 P-GPS-GATE — attach a fresh GPS fix so the backend presence check
+    // can confirm the rider is at the store (picked_up) / customer (delivered).
+    // Mirrors acceptOrder()'s fresh getCurrentPosition + lat/lng keys. Guarded:
+    // a location error degrades to "no coords sent" (the backend gate is
+    // fail-safe and decides per its toggle) rather than hard-blocking the
+    // completion call itself.
+    String? gpsLat, gpsLng;
+    try {
+      final Position pos = await Geolocator.getCurrentPosition();
+      gpsLat = pos.latitude.toString();
+      gpsLng = pos.longitude.toString();
+    } catch (_) {}
+
     if (updateStatusBody.isParcel ?? false) {
       data = {'_method': 'put', 'token' : updateStatusBody.token!, 'order_id': updateStatusBody.orderId.toString(), 'status': updateStatusBody.status.toString(),
         'otp': updateStatusBody.otp.toString(), 'reason': updateStatusBody.reasons.toString(), 'note': updateStatusBody.comment ?? ''};
@@ -88,6 +101,10 @@
       data = {'_method': 'put', 'token' : updateStatusBody.token!, 'order_id': updateStatusBody.orderId.toString(), 'status': updateStatusBody.status.toString(),
         'otp': updateStatusBody.otp.toString(), 'reason': updateStatusBody.reason ?? ''};
     }
+    if (gpsLat != null && gpsLng != null) {
+      data['lat'] = gpsLat;
+      data['lng'] = gpsLng;
+    }
 
     Response response = await apiClient.postMultipartData(AppConstants.updateOrderStatusUri, data, proofAttachment, handleError: false);
     if (response.statusCode == 200) {
--- lib/features/delivery_module/order/widgets/pickup_pin_entry_widget.dart.bak-gpsgate	2026-05-30 09:07:14.956019470 +0000
+++ lib/features/delivery_module/order/widgets/pickup_pin_entry_widget.dart	2026-05-30 09:07:45.864664977 +0000
@@ -24,6 +24,7 @@
 
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
+import 'package:geolocator/geolocator.dart';
 import 'package:get/get.dart';
 
 import 'package:sixam_mart_delivery/api/api_client.dart';
@@ -116,7 +117,19 @@
       final apiClient = Get.find<ApiClient>();
       final token = Get.find<AuthController>().getUserToken();
       final uri = AppConstants.verifyPickupPinUri.replaceFirst('{orderId}', widget.orderId.toString());
-      final resp = await apiClient.postData(uri, {'token': token, 'pin': _pin}, handleError: false);
+
+      // d50 P-GPS-GATE — attach a fresh GPS fix so the backend can confirm the
+      // rider is at the store before flipping picked_up (the post-PIN presence
+      // check on verify-pickup-pin). Mirrors acceptOrder()'s lat/lng. Guarded:
+      // a location error degrades to "no coords" (backend gate is fail-safe)
+      // rather than blocking PIN submission.
+      final Map<String, dynamic> body = {'token': token, 'pin': _pin};
+      try {
+        final Position pos = await Geolocator.getCurrentPosition();
+        body['lat'] = pos.latitude;
+        body['lng'] = pos.longitude;
+      } catch (_) {}
+      final resp = await apiClient.postData(uri, body, handleError: false);
 
       if (resp.statusCode == 200) {
         // Dismiss synchronously first — deferring behind the list-
