{"openapi":"3.0.0","info":{"version":"1.0.0","title":"2i Mobile payment API","description":"REST API of 2i petrol stations Mobile payment"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/2ionline/2i-mobile-payment-API/1.0.0"},{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/2ionline/2i_Mobile_Payment_API/1.0.0"}],"tags":[{"name":"petrol-stations","description":"Petrol stations information"},{"name":"preauthorized-fueling","description":"Pre-authorized fueling"},{"name":"callback","description":"Provider API for callback notifications from petrol stations API"},{"name":"authentication","description":"Authentication protocol"}],"paths":{"/petrol-stations":{"get":{"summary":"Information about petrol stations network","tags":["petrol-stations"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":1000,"default":50},"required":false,"description":"number of stations in one paged query"},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0},"required":false,"description":"Number of skipped elements in paged query"}],"responses":{"200":{"description":"List of petrol stations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PetrolStation"}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/petrol-stations/{stationId}":{"get":{"summary":"Information about the petrol station","tags":["petrol-stations"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"stationId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Petrol station information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PetrolStation"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/petrol-stations/{stationId}/pumps":{"get":{"summary":"Information about pumps and products of the petrol station","tags":["preauthorized-fueling"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"stationId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"List of pumps","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Pump"}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fueling-processes":{"post":{"summary":"Start of the fueling process","tags":["preauthorized-fueling"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FuelingProcessRequest"}}}},"responses":{"201":{"description":"Request accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FuelingProcessResponse"}}}},"401":{"description":"Unauthorized"},"default":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fueling-processes/{fuelingProcessId}/cancel":{"post":{"summary":"Fueling process cancellation (abort)","tags":["preauthorized-fueling"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"fuelingProcessId","schema":{"type":"string"},"required":true}],"responses":{"204":{"description":"Process cancelled"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fueling-processes/{fuelingProcessId}/state":{"get":{"summary":"Current fueling process state","tags":["preauthorized-fueling"],"parameters":[{"in":"path","name":"fuelingProcessId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Trarsaction  state","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProcessCreatedState"},{"$ref":"#/components/schemas/PumpReadyState"},{"$ref":"#/components/schemas/TankingState"},{"$ref":"#/components/schemas/ProcessedState"},{"$ref":"#/components/schemas/RejectedState"}],"discriminator":{"propertyName":"code","mapping":{"created":"#/components/schemas/ProcessCreatedState","pumpReady":"#/components/schemas/PumpReadyState","tanking":"#/components/schemas/TankingState","processed":"#/components/schemas/ProcessedState","rejected":"#/components/schemas/RejectedState"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/callback/fueling-processes/events":{"post":{"summary":"Provider endpoint for events from petrol stations API for the pre-authorized fueling","tags":["callback"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/FuelingProcessCreated"},{"$ref":"#/components/schemas/PumpReady"},{"$ref":"#/components/schemas/TankingStarted"},{"$ref":"#/components/schemas/FuelingCompleted"},{"$ref":"#/components/schemas/FuelingRejected"},{"$ref":"#/components/schemas/InvoicePrinted"}],"discriminator":{"propertyName":"state","mapping":{"created":"#/components/schemas/FuelingProcessCreated","pumpReady":"#/components/schemas/PumpReady","tanking":"#/components/schemas/TankingStarted","processed":"#/components/schemas/FuelingCompleted","rejected":"#/components/schemas/FuelingRejected","invoicePrinted":"#/components/schemas/InvoicePrinted"}}}}}},"responses":{"204":{"description":"Event received"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/token":{"post":{"summary":"Authenticate using login and password","tags":["authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenAuthRequest"}}}},"responses":{"200":{"description":"Authentication result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResult"}}}},"400":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"PetrolStation":{"type":"object","description":"Petrol station information","properties":{"stationId":{"type":"string"},"name":{"type":"string"},"fullAddress":{"type":"string","description":"Full Address"},"location":{"$ref":"#/components/schemas/Location"},"fuelPumpsQty":{"type":"number","description":"Number of pumps in the station"},"fuelProducts":{"type":"array","items":{"$ref":"#/components/schemas/FuelProduct"}},"brand":{"$ref":"#/components/schemas/PetrolStationBrand"},"available":{"type":"boolean","description":"Indicates current availability of the station"}},"required":["stationId","name","fullAddress","location","brand"]},"PetrolStationBrand":{"type":"object","description":"petrol station brand","properties":{"name":{"type":"string"},"code":{"type":"string"}},"required":["name","code"]},"Location":{"type":"object","description":"GPS coordinates","properties":{"longitude":{"type":"number","format":"double","maximum":180,"minimum":-180},"latitude":{"type":"number","format":"double","maximum":90,"minimum":-90}},"required":["longitude","latitude"]},"FuelProduct":{"type":"object","description":"Fuel product information","properties":{"productId":{"type":"string","description":"product code"},"type":{"type":"string","enum":["a92","a95","a98","a100","diesel","gasoline","adblue"],"description":"Fuel type or gasoline octane rating"},"name":{"type":"string"},"price":{"$ref":"#/components/schemas/Money"},"vatRate":{"type":"number","description":"VAT rate"}},"required":["productId","type","price","name"]},"Pump":{"type":"object","description":"petrol station pump information","properties":{"number":{"type":"integer","minimum":1,"maximum":100,"example":1,"description":"pump number"},"products":{"type":"array","items":{"$ref":"#/components/schemas/FuelProduct"}}},"required":["number","products","available","paymentMode"]},"FuelingProcessRequest":{"type":"object","description":"Fueling process creation request","properties":{"senderFuelingProcessId":{"type":"string","description":"2i unique process identifier"},"authorizationInfo":{"$ref":"#/components/schemas/AuthorizationInfo"},"stationId":{"type":"string"},"pumpNumber":{"type":"integer","description":"pump number","example":1},"fuelProductId":{"type":"string","description":"product code"},"amount":{"$ref":"#/components/schemas/Money"},"callbackAccessToken":{"type":"string","description":"Access token for sending callbacks"},"matchingReference":{"type":"string","description":"Reference for reconciliation"}},"required":["senderFuelingProcessId","authorizationInfo","stationId","pumpNumber","fuelProductId","amount","callbackAccessToken","matchingReference"]},"AuthorizationInfo":{"type":"object","description":"Authorization details","properties":{"stan":{"type":"string","description":"System trace audit number"},"batchId":{"type":"string","description":"Batch/sequence number"},"rrn":{"type":"string","description":"Retrieval reference number"},"authCode":{"type":"string"}},"required":["stan","batchId","rrn"]},"FuelingProcessResponse":{"type":"object","description":"Process creation result","properties":{"fuelingProcessId":{"type":"string","description":"Process identifier"}},"required":["fuelingProcessId"]},"FuelingProcessCreated":{"type":"object","description":"Process state changed to created","properties":{"fuelingProcessId":{"type":"string"},"senderFuelingProcessId":{"type":"string"},"state":{"type":"string","enum":["created"]}},"required":["fuelingProcessId","senderFuelingProcessId","state"]},"TankingStarted":{"type":"object","description":"Process state changed to tanking","properties":{"fuelingProcessId":{"type":"string"},"senderFuelingProcessId":{"type":"string"},"state":{"type":"string","enum":["tanking"]},"dispensedQuantity":{"type":"number","description":"Tanking progress in litres"}},"required":["fuelingProcessId","senderFuelingProcessId","state"]},"PumpReady":{"type":"object","description":"Process state changed to pumpReady","properties":{"fuelingProcessId":{"type":"string"},"senderFuelingProcessId":{"type":"string"},"state":{"type":"string","enum":["pumpReady"]}},"required":["fuelingProcessId","senderFuelingProcessId","state"]},"FuelingCompleted":{"type":"object","description":"Process state changed to processed","properties":{"fuelingProcessId":{"type":"string"},"senderFuelingProcessId":{"type":"string"},"state":{"type":"string","enum":["processed"]},"receipt":{"$ref":"#/components/schemas/Receipt"}},"required":["fuelingProcessId","senderFuelingProcessId","state","receipt"]},"InvoicePrinted":{"type":"object","description":"Process state changed to \"invoicePrinted\"","properties":{"fuelingProcessId":{"type":"string"},"senderFuelingProcessId":{"type":"string"},"state":{"type":"string","enum":["invoicePrinted"]},"reportId":{"type":"string","description":"id of the invoice pdf file"}},"required":["fuelingProcessId","senderFuelingProcessId","state","reportId"]},"FuelingRejected":{"type":"object","description":"Process state changed to rejected","properties":{"fuelingProcessId":{"type":"string"},"senderFuelingProcessId":{"type":"string"},"state":{"type":"string","enum":["rejected"]},"rejectionReasonCode":{"type":"string","enum":["tankingTimedOut","tankingNotStarted","pumpInUse","systemError"]},"rejectionReasonDescription":{"type":"string"}},"required":["fuelingProcessId","senderFuelingProcessId","state","rejectionReasonCode"]},"Receipt":{"type":"object","description":"Fueling result (receipt)","properties":{"billId":{"type":"string"},"product":{"$ref":"#/components/schemas/FuelProduct"},"quantity":{"type":"number","description":"Actual filled quantity (in litres)"},"amount":{"$ref":"#/components/schemas/Money"},"vatRate":{"type":"number","description":"VAT rate"},"vatAmount":{"$ref":"#/components/schemas/Money"},"discountAmount":{"$ref":"#/components/schemas/Money"},"amountWithoutDiscount":{"$ref":"#/components/schemas/Money"}},"required":["product","quantity","amount","vatRate","vatAmount","amountWithoutDiscount","discountAmount"]},"Money":{"type":"object","description":"amount of money","properties":{"currency":{"type":"string","description":"currency code, 3-character (ISO 4217)","example":"EUR"},"amount":{"type":"number","format":"currency","description":"Amount"}},"required":["currency","amount"]},"TokenAuthRequest":{"type":"object","description":"Login/password authentication request","properties":{"login":{"type":"string"},"password":{"type":"string"}},"required":["login","password"]},"AuthResult":{"type":"object","description":"Authentication result","properties":{"token":{"type":"string","description":"Bearer access token"}},"required":["accessToken"]},"Error":{"type":"object","description":"Error","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"ProcessCreatedState":{"description":"Process state \"created\"","allOf":[{"$ref":"#/components/schemas/FuelingProcessState"},{"type":"object","required":["code"]}]},"PumpReadyState":{"description":"Process state \"pumpReady\" (Pump is ready. Driver can start tanking)","allOf":[{"$ref":"#/components/schemas/FuelingProcessState"},{"type":"object","required":["code"]}]},"TankingState":{"description":"Process state \"tanking\" (Tanking is in progress)","allOf":[{"$ref":"#/components/schemas/FuelingProcessState"},{"type":"object","properties":{"filledQuantity":{"type":"number","description":"Tanking progress in litres"}},"required":["code"]}]},"ProcessedState":{"description":"Process state \"processed\" (Fueling is finished)","allOf":[{"$ref":"#/components/schemas/FuelingProcessState"},{"type":"object","properties":{"reciept":{"$ref":"#/components/schemas/Receipt"}},"required":["code"]}]},"RejectedState":{"description":"Process state \"rejected\" (Process is cancelled or aborted)","allOf":[{"$ref":"#/components/schemas/FuelingProcessState"},{"type":"object","properties":{"rejectionReasonCode":{"type":"string","description":"Rejection reason"}},"required":["code","rejectionReasonCode"]}]},"ProcessStateCode":{"type":"string","description":"Fueling process state codes","enum":["created","pumpReady","tanking","processed","rejected"]},"FuelingProcessState":{"type":"object","description":"Fueling process state","properties":{"code":{"$ref":"#/components/schemas/ProcessStateCode"}},"required":["code"]}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}}}