migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RestaurantDelivery\Contracts;
|
||||
|
||||
use Modules\RestaurantDelivery\Models\Delivery;
|
||||
use Modules\RestaurantDelivery\Models\Rider;
|
||||
|
||||
interface EarningsCalculatorInterface
|
||||
{
|
||||
/**
|
||||
* Calculate earnings for a delivery.
|
||||
*/
|
||||
public function calculateForDelivery(Delivery $delivery): array;
|
||||
|
||||
/**
|
||||
* Calculate base earnings.
|
||||
*/
|
||||
public function calculateBaseEarnings(Delivery $delivery): float;
|
||||
|
||||
/**
|
||||
* Calculate distance-based earnings.
|
||||
*/
|
||||
public function calculateDistanceEarnings(Delivery $delivery): float;
|
||||
|
||||
/**
|
||||
* Calculate applicable bonuses.
|
||||
*/
|
||||
public function calculateBonuses(Delivery $delivery, Rider $rider): array;
|
||||
|
||||
/**
|
||||
* Calculate applicable penalties.
|
||||
*/
|
||||
public function calculatePenalties(Delivery $delivery, Rider $rider): array;
|
||||
|
||||
/**
|
||||
* Calculate commission.
|
||||
*/
|
||||
public function calculateCommission(float $grossAmount, Rider $rider): array;
|
||||
|
||||
/**
|
||||
* Get rider's earnings summary for a period.
|
||||
*/
|
||||
public function getRiderEarningsSummary(Rider $rider, string $period = 'week'): array;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RestaurantDelivery\Contracts;
|
||||
|
||||
interface FirebaseServiceInterface
|
||||
{
|
||||
/**
|
||||
* Check if Firebase is enabled.
|
||||
*/
|
||||
public function isEnabled(): bool;
|
||||
|
||||
/**
|
||||
* Update rider location in Firebase.
|
||||
*/
|
||||
public function updateRiderLocation(
|
||||
int|string $riderId,
|
||||
float $latitude,
|
||||
float $longitude,
|
||||
?float $speed = null,
|
||||
?float $bearing = null,
|
||||
?float $accuracy = null
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* Get rider location from Firebase.
|
||||
*/
|
||||
public function getRiderLocation(int|string $riderId): ?array;
|
||||
|
||||
/**
|
||||
* Check if rider location is stale.
|
||||
*/
|
||||
public function isRiderLocationStale(int|string $riderId): bool;
|
||||
|
||||
/**
|
||||
* Update rider status in Firebase.
|
||||
*/
|
||||
public function updateRiderStatus(int|string $riderId, string $status): bool;
|
||||
|
||||
/**
|
||||
* Initialize delivery tracking in Firebase.
|
||||
*/
|
||||
public function initializeDeliveryTracking(int|string $deliveryId, array $data): bool;
|
||||
|
||||
/**
|
||||
* Update delivery rider location in Firebase.
|
||||
*/
|
||||
public function updateDeliveryRiderLocation(
|
||||
int|string $deliveryId,
|
||||
float $latitude,
|
||||
float $longitude,
|
||||
?float $speed = null,
|
||||
?float $bearing = null,
|
||||
?int $eta = null,
|
||||
?float $remainingDistance = null
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* Update delivery status in Firebase.
|
||||
*/
|
||||
public function updateDeliveryStatus(int|string $deliveryId, string $status, array $metadata = []): bool;
|
||||
|
||||
/**
|
||||
* Update delivery route in Firebase.
|
||||
*/
|
||||
public function updateDeliveryRoute(int|string $deliveryId, array $route): bool;
|
||||
|
||||
/**
|
||||
* Get delivery tracking data from Firebase.
|
||||
*/
|
||||
public function getDeliveryTracking(int|string $deliveryId): ?array;
|
||||
|
||||
/**
|
||||
* Remove delivery tracking from Firebase.
|
||||
*/
|
||||
public function removeDeliveryTracking(int|string $deliveryId): bool;
|
||||
|
||||
/**
|
||||
* Remove rider assignment from Firebase.
|
||||
*/
|
||||
public function removeRiderAssignment(int|string $riderId, int|string $deliveryId): bool;
|
||||
|
||||
/**
|
||||
* Send push notification via FCM.
|
||||
*/
|
||||
public function sendPushNotification(
|
||||
string $token,
|
||||
string $title,
|
||||
string $body,
|
||||
array $data = []
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* Send push notification to multiple devices.
|
||||
*/
|
||||
public function sendMulticastNotification(
|
||||
array $tokens,
|
||||
string $title,
|
||||
string $body,
|
||||
array $data = []
|
||||
): array;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RestaurantDelivery\Contracts;
|
||||
|
||||
interface MapsServiceInterface
|
||||
{
|
||||
/**
|
||||
* Get route between two points.
|
||||
*/
|
||||
public function getRoute(
|
||||
float $originLat,
|
||||
float $originLng,
|
||||
float $destLat,
|
||||
float $destLng,
|
||||
array $options = []
|
||||
): ?array;
|
||||
|
||||
/**
|
||||
* Get distance between two points.
|
||||
*/
|
||||
public function getDistance(
|
||||
float $originLat,
|
||||
float $originLng,
|
||||
float $destLat,
|
||||
float $destLng
|
||||
): ?array;
|
||||
|
||||
/**
|
||||
* Get ETA between two points.
|
||||
*/
|
||||
public function getETA(
|
||||
float $originLat,
|
||||
float $originLng,
|
||||
float $destLat,
|
||||
float $destLng
|
||||
): ?int;
|
||||
|
||||
/**
|
||||
* Geocode an address to coordinates.
|
||||
*/
|
||||
public function geocode(string $address): ?array;
|
||||
|
||||
/**
|
||||
* Reverse geocode coordinates to address.
|
||||
*/
|
||||
public function reverseGeocode(float $latitude, float $longitude): ?array;
|
||||
|
||||
/**
|
||||
* Calculate distance using Haversine formula.
|
||||
*/
|
||||
public function calculateHaversineDistance(
|
||||
float $lat1,
|
||||
float $lng1,
|
||||
float $lat2,
|
||||
float $lng2
|
||||
): float;
|
||||
|
||||
/**
|
||||
* Decode polyline to array of coordinates.
|
||||
*/
|
||||
public function decodePolyline(string $encodedPolyline): array;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RestaurantDelivery\Contracts;
|
||||
|
||||
use Modules\RestaurantDelivery\Models\Delivery;
|
||||
use Modules\RestaurantDelivery\Models\DeliveryRating;
|
||||
use Modules\RestaurantDelivery\Models\Rider;
|
||||
|
||||
interface RatingServiceInterface
|
||||
{
|
||||
/**
|
||||
* Create a rating for a delivery.
|
||||
*/
|
||||
public function createRating(
|
||||
Delivery $delivery,
|
||||
int $overallRating,
|
||||
array $categoryRatings = [],
|
||||
?string $review = null,
|
||||
array $tags = [],
|
||||
bool $isAnonymous = false,
|
||||
?int $customerId = null,
|
||||
bool $isRestaurantRating = false
|
||||
): ?DeliveryRating;
|
||||
|
||||
/**
|
||||
* Check if delivery can be rated.
|
||||
*/
|
||||
public function canRate(Delivery $delivery, bool $isRestaurantRating = false): bool;
|
||||
|
||||
/**
|
||||
* Validate rating value.
|
||||
*/
|
||||
public function isValidRating(int $rating): bool;
|
||||
|
||||
/**
|
||||
* Validate review.
|
||||
*/
|
||||
public function isValidReview(?string $review): bool;
|
||||
|
||||
/**
|
||||
* Add rider's response to a rating.
|
||||
*/
|
||||
public function addRiderResponse(DeliveryRating $rating, string $response): bool;
|
||||
|
||||
/**
|
||||
* Approve a rating.
|
||||
*/
|
||||
public function approveRating(DeliveryRating $rating): void;
|
||||
|
||||
/**
|
||||
* Reject a rating.
|
||||
*/
|
||||
public function rejectRating(DeliveryRating $rating, string $reason): void;
|
||||
|
||||
/**
|
||||
* Get rider's rating statistics.
|
||||
*/
|
||||
public function getRiderStats(Rider $rider): array;
|
||||
|
||||
/**
|
||||
* Get available rating categories.
|
||||
*/
|
||||
public function getCategories(): array;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RestaurantDelivery\Contracts;
|
||||
|
||||
use Modules\RestaurantDelivery\Models\Delivery;
|
||||
use Modules\RestaurantDelivery\Models\DeliveryTip;
|
||||
use Modules\RestaurantDelivery\Models\Rider;
|
||||
|
||||
interface TipServiceInterface
|
||||
{
|
||||
/**
|
||||
* Create a pre-delivery tip.
|
||||
*/
|
||||
public function createPreDeliveryTip(
|
||||
Delivery $delivery,
|
||||
float $amount,
|
||||
?int $customerId = null,
|
||||
string $calculationType = 'fixed',
|
||||
?float $percentageValue = null,
|
||||
?string $message = null
|
||||
): ?DeliveryTip;
|
||||
|
||||
/**
|
||||
* Create a post-delivery tip.
|
||||
*/
|
||||
public function createPostDeliveryTip(
|
||||
Delivery $delivery,
|
||||
float $amount,
|
||||
?int $customerId = null,
|
||||
string $calculationType = 'fixed',
|
||||
?float $percentageValue = null,
|
||||
?string $message = null
|
||||
): ?DeliveryTip;
|
||||
|
||||
/**
|
||||
* Mark tip as paid.
|
||||
*/
|
||||
public function markTipAsPaid(
|
||||
DeliveryTip $tip,
|
||||
string $paymentReference,
|
||||
string $paymentMethod
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* Process tip payment.
|
||||
*/
|
||||
public function processTipPayment(DeliveryTip $tip, array $paymentData): bool;
|
||||
|
||||
/**
|
||||
* Check if pre-delivery tip is allowed.
|
||||
*/
|
||||
public function canTipPreDelivery(Delivery $delivery): bool;
|
||||
|
||||
/**
|
||||
* Check if post-delivery tip is allowed.
|
||||
*/
|
||||
public function canTipPostDelivery(Delivery $delivery): bool;
|
||||
|
||||
/**
|
||||
* Validate tip amount.
|
||||
*/
|
||||
public function isValidAmount(
|
||||
float $amount,
|
||||
string $calculationType,
|
||||
?float $percentageValue,
|
||||
float $orderValue
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* Get tip options for display.
|
||||
*/
|
||||
public function getTipOptions(Delivery $delivery): array;
|
||||
|
||||
/**
|
||||
* Get rider's tip statistics.
|
||||
*/
|
||||
public function getRiderTipStats(Rider $rider, ?string $period = null): array;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RestaurantDelivery\Contracts;
|
||||
|
||||
use Modules\RestaurantDelivery\Models\Delivery;
|
||||
use Modules\RestaurantDelivery\Models\Rider;
|
||||
|
||||
interface TrackingServiceInterface
|
||||
{
|
||||
/**
|
||||
* Update rider's live location.
|
||||
*/
|
||||
public function updateRiderLocation(
|
||||
Rider $rider,
|
||||
float $latitude,
|
||||
float $longitude,
|
||||
?float $speed = null,
|
||||
?float $bearing = null,
|
||||
?float $accuracy = null
|
||||
): array;
|
||||
|
||||
/**
|
||||
* Get last known rider location.
|
||||
*/
|
||||
public function getLastRiderLocation(int|string $riderId): ?array;
|
||||
|
||||
/**
|
||||
* Check if rider has valid location.
|
||||
*/
|
||||
public function hasValidLocation(Rider $rider): bool;
|
||||
|
||||
/**
|
||||
* Initialize tracking for a new delivery.
|
||||
*/
|
||||
public function initializeDeliveryTracking(Delivery $delivery): bool;
|
||||
|
||||
/**
|
||||
* Update delivery tracking with new rider location.
|
||||
*/
|
||||
public function updateDeliveryTracking(
|
||||
Delivery $delivery,
|
||||
float $latitude,
|
||||
float $longitude,
|
||||
?float $speed = null,
|
||||
?float $bearing = null
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Update delivery status in tracking.
|
||||
*/
|
||||
public function updateDeliveryStatus(Delivery $delivery, ?array $metadata = null): void;
|
||||
|
||||
/**
|
||||
* Get current tracking data for a delivery.
|
||||
*/
|
||||
public function getDeliveryTracking(Delivery $delivery): ?array;
|
||||
|
||||
/**
|
||||
* End tracking for completed/cancelled delivery.
|
||||
*/
|
||||
public function endDeliveryTracking(Delivery $delivery): void;
|
||||
}
|
||||
Reference in New Issue
Block a user