Documentation ¶
Index ¶
- Variables
- type Coordinates
- type Customer
- type DeliveryAddress
- type DeliveryInformationResponse
- type Item
- type OrderDetails
- type Payment
- type Service
- type Subitem
- type TrackingResponse
- type V2Benefit
- type V2Customer
- type V2DeliveryInformation
- type V2Indoor
- type V2Item
- type V2MerchantInfos
- type V2OrderDetails
- type V2OrderValues
- type V2Payments
- type V2Schedule
- type V2Takeout
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrOrderReferenceNotSpecified no order_id specified ErrOrderReferenceNotSpecified = errors.New("Order reference not specified") // ErrCancelCodeNotSpecified no cancel code provided ErrCancelCodeNotSpecified = errors.New("Order cancel code not specified") )
View Source
var ( // CancelCodes are all valid iFood API cancellation codes CancelCodes = map[string]string{ "501": "PROBLEMAS DE SISTEMA", "502": "PEDIDO EM DUPLICIDADE", "503": "ITEM INDISPONÍVEL", "504": "RESTAURANTE SEM MOTOBOY", "505": "CARDÁPIO DESATUALIZADO", "506": "PEDIDO FORA DA ÁREA DE ENTREGA", "507": "CLIENTE GOLPISTA / TROTE", "508": "FORA DO HORÁRIO DO DELIVERY", "509": "DIFICULDADES INTERNAS DO RESTAURANTE", "511": "ÁREA DE RISCO", "512": "RESTAURANTE ABRIRÁ MAIS TARDE", "513": "RESTAURANTE FECHOU MAIS CEDO", "803": "ITEM INDISPONÍVEL", "805": "RESTAURANTE SEM MOTOBOY", "801": "PROBLEMAS DE SISTEMA", "804": "CADASTRO DO CLIENTE INCOMPLETO - CLIENTE NÃO ATENDE", "807": "PEDIDO FORA DA ÁREA DE ENTREGA", "808": "CLIENTE GOLPISTA / TROTE", "809": "FORA DO HORÁRIO DO DELIVERY", "815": "DIFICULDADES INTERNAS DO RESTAURANTE", "818": "TAXA DE ENTREGA INCONSISTENTE", "820": "ÁREA DE RISCO", } )
Functions ¶
This section is empty.
Types ¶
type Coordinates ¶
Coordinates of a delivery
type Customer ¶
type Customer struct { ID string `json:"id"` UUID string `json:"uuid"` Name string `json:"name"` Taxpayeridentificationnumber string `json:"taxPayerIdentificationNumber"` Phone string `json:"phone"` Orderscountonrestaurant string `json:"ordersCountOnRestaurant"` }
Customer details
type DeliveryAddress ¶
type DeliveryAddress struct { Formattedaddress string `json:"formattedAddress"` Country string `json:"country"` State string `json:"state"` City string `json:"city"` Coordinates Coordinates `json:"coordinates"` Neighborhood string `json:"neighborhood"` Streetname string `json:"streetName"` Streetnumber string `json:"streetNumber"` Postalcode string `json:"postalCode"` Reference string `json:"reference"` Complement string `json:"complement"` }
DeliveryAddress from customer
type DeliveryInformationResponse ¶
type DeliveryInformationResponse struct { ExternalID string `json:"externalId"` OrderStatus string `json:"orderStatus"` WorkerName string `json:"workerName"` WorkerPhone string `json:"workerPhone"` WorkerPhoto string `json:"workerPhoto"` VehicleType string `json:"vehicleType"` VehiclePlateNumber interface{} `json:"vehiclePlateNumber"` LogisticCompany string `json:"logisticCompany"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Eta int `json:"eta"` }
DeliveryInformationResponse API response of the delivery
type Item ¶
type Item struct { Name string `json:"name"` Quantity string `json:"quantity"` Price string `json:"price"` Subitemsprice string `json:"subItemsPrice"` Totalprice string `json:"totalPrice"` Discount string `json:"discount"` Addition string `json:"addition"` Externalcode string `json:"externalCode,omitempty"` Subitems []Subitem `json:"subItems,omitempty"` Observations string `json:"observations,omitempty"` }
Item of the order
type OrderDetails ¶
type OrderDetails struct { ID string `json:"id"` Reference string `json:"reference"` Shortreference string `json:"shortReference"` Createdat string `json:"createdAt"` Type string `json:"type"` Merchant merchant.Merchant `json:"merchant"` Payments []Payment `json:"payments"` Customer Customer `json:"customer"` Items []Item `json:"items"` Subtotal string `json:"subTotal"` Totalprice string `json:"totalPrice"` Deliveryfee string `json:"deliveryFee"` Deliveryaddress DeliveryAddress `json:"deliveryAddress"` Deliverydatetime string `json:"deliveryDateTime"` Preparationtimeinseconds string `json:"preparationTimeInSeconds"` }
OrderDetails endpoint return
type Payment ¶
type Payment struct { Name string `json:"name"` Code string `json:"code"` Value string `json:"value"` Prepaid string `json:"prepaid"` Issuer string `json:"issuer"` Collector string `json:"collector,omitempty"` }
Payment details
type Service ¶
type Service interface { GetDetails(reference string) (OrderDetails, error) V2GetDetails(reference string) (V2OrderDetails, error) SetIntegrateStatus(reference string) error SetConfirmStatus(reference string) error V2SetConfirmStatus(reference string) error SetDispatchStatus(reference string) error V2SetDispatchStatus(reference string) error SetReadyToDeliverStatus(reference string) error V2SetReadyToPickupStatus(reference string) error SetCancelStatus(reference, code string) error V2RequestCancelStatus(reference, code string) error ClientCancellationStatus(reference string, accepted bool) error V2ClientCancellationStatus(reference string, accepted bool) error Tracking(orderUUID string) (TrackingResponse, error) DeliveryInformation(orderUUID string) (DeliveryInformationResponse, error) }
Service determinates the order's interface
type Subitem ¶
type Subitem struct { Name string `json:"name"` Quantity string `json:"quantity"` Price string `json:"price"` Totalprice string `json:"totalPrice"` Discount string `json:"discount"` Addition string `json:"addition"` Externalcode string `json:"externalCode"` }
Subitem of the order
type TrackingResponse ¶
type TrackingResponse struct { Date interface{} `json:"date"` DeliveryTime time.Time `json:"deliveryTime"` Eta int `json:"eta"` EtaToDestination int `json:"etaToDestination"` EtaToOrigin int `json:"etaToOrigin"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` OrderID string `json:"orderId"` TrackDate time.Time `json:"trackDate"` }
TrackingResponse API response of tracking
type V2Customer ¶ added in v1.1.1
type V2Customer struct { Phone struct { Number string `json:"number"` Localizer string `json:"localizer"` Localizerexpiration time.Time `json:"localizerExpiration"` } `json:"phone"` Documentnumber string `json:"documentNumber"` Name string `json:"name"` Orderscountonmerchant int `json:"ordersCountOnMerchant"` ID string `json:"id"` }
type V2DeliveryInformation ¶ added in v1.1.1
type V2DeliveryInformation struct { Mode string `json:"mode"` Deliveredby string `json:"deliveredBy"` Deliveryaddress struct { Reference string `json:"reference"` Country string `json:"country"` Streetname string `json:"streetName"` Formattedaddress string `json:"formattedAddress"` Streetnumber string `json:"streetNumber"` City string `json:"city"` Postalcode string `json:"postalCode"` Coordinates struct { Latitude int `json:"latitude"` Longitude int `json:"longitude"` } `json:"coordinates"` Neighborhood string `json:"neighborhood"` State string `json:"state"` Complement string `json:"complement"` } `json:"deliveryAddress"` Deliverydatetime time.Time `json:"deliveryDateTime"` }
type V2Item ¶ added in v1.1.1
type V2Item struct { Unitprice int `json:"unitPrice"` Quantity int `json:"quantity"` Externalcode string `json:"externalCode"` Totalprice int `json:"totalPrice"` Index int `json:"index"` Unit string `json:"unit"` Ean string `json:"ean"` Price int `json:"price"` Observations string `json:"observations"` Name string `json:"name"` Options []struct { Unitprice int `json:"unitPrice"` Unit string `json:"unit"` Ean string `json:"ean"` Quantity int `json:"quantity"` Externalcode string `json:"externalCode"` Price int `json:"price"` Name string `json:"name"` Index int `json:"index"` ID string `json:"id"` } `json:"options"` ID string `json:"id"` Optionsprice int `json:"optionsPrice"` }
type V2MerchantInfos ¶ added in v1.1.1
type V2OrderDetails ¶ added in v1.1.1
type V2OrderDetails struct { Benefits []V2Benefit `json:"benefits"` Ordertype string `json:"orderType"` Payments V2Payments `json:"payments"` Merchant V2MerchantInfos `json:"merchant"` SalesChannel string `json:"salesChannel"` OrderTiming string `json:"orderTiming"` CreatedAt time.Time `json:"createdAt"` Total V2OrderValues `json:"total"` PreparationStartDatetime time.Time `json:"preparationStartDateTime"` ID string `json:"id"` DisplayID string `json:"displayId"` Items []V2Item `json:"items"` Customer V2Customer `json:"customer"` ExtraInfo string `json:"extraInfo"` Delivery V2DeliveryInformation `json:"delivery"` Schedule V2Schedule `json:"schedule"` Indoor V2Indoor `json:"indoor"` Takeout V2Takeout `json:"takeout"` }
type V2OrderValues ¶ added in v1.1.1
type V2Payments ¶ added in v1.1.1
type V2Payments struct { Methods []struct { Wallet struct { Name string `json:"name"` } `json:"wallet"` Method string `json:"method"` Prepaid bool `json:"prepaid"` Currency string `json:"currency"` Type string `json:"type"` Value int `json:"value"` Cash struct { Changefor int `json:"changeFor"` } `json:"cash"` Card struct { Brand string `json:"brand"` } `json:"card"` } `json:"methods"` Pending int `json:"pending"` Prepaid int `json:"prepaid"` }
type V2Schedule ¶ added in v1.1.1
Click to show internal directories.
Click to hide internal directories.