saveinmed/backend/internal/domain/shipping.go
Gabbriiel 90467db1ec refactor: substitui backend Medusa por backend Go e corrige testes do marketplace
- Remove backend Medusa.js (TypeScript) e substitui pelo backend Go (saveinmed-performance-core)
- Corrige testes auth.test.ts: alinha paths de API (v1/ sem barra inicial) e campo access_token
- Corrige GroupedProductCard.test.tsx: ajusta distância formatada (toFixed) e troca userEvent por fireEvent com fakeTimers
- Corrige AuthContext.test.tsx: usa vi.hoisted() para mocks e corrige parênteses no waitFor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 04:56:37 -06:00

44 lines
2 KiB
Go

package domain
import (
"time"
"github.com/gofrs/uuid/v5"
)
// ShippingMethodType defines supported fulfillment modes.
type ShippingMethodType string
const (
ShippingMethodPickup ShippingMethodType = "pickup"
ShippingMethodOwnDelivery ShippingMethodType = "own_delivery"
ShippingMethodThirdParty ShippingMethodType = "third_party_delivery"
ShippingOptionTypePickup = "pickup"
ShippingOptionTypeDelivery = "delivery"
)
// ShippingMethod stores vendor configuration for pickup or delivery.
type ShippingMethod struct {
ID uuid.UUID `db:"id" json:"id"`
VendorID uuid.UUID `db:"vendor_id" json:"vendor_id"`
Type ShippingMethodType `db:"type" json:"type"`
Active bool `db:"active" json:"active"`
PreparationMinutes int `db:"preparation_minutes" json:"preparation_minutes"`
MaxRadiusKm float64 `db:"max_radius_km" json:"max_radius_km"`
MinFeeCents int64 `db:"min_fee_cents" json:"min_fee_cents"`
PricePerKmCents int64 `db:"price_per_km_cents" json:"price_per_km_cents"`
FreeShippingThresholdCents *int64 `db:"free_shipping_threshold_cents" json:"free_shipping_threshold_cents,omitempty"`
PickupAddress string `db:"pickup_address" json:"pickup_address"`
PickupHours string `db:"pickup_hours" json:"pickup_hours"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}
// ShippingOption presents calculated options to the buyer.
type ShippingOption struct {
Type string `json:"type"`
ValueCents int64 `json:"value_cents"`
EstimatedMinutes int `json:"estimated_minutes"`
Description string `json:"description"`
DistanceKm float64 `json:"distance_km,omitempty"`
}