{"openapi":"3.0.1","info":{"title":"FluxVend Inventory Management API","description":"Documentation for Inventory Management Service API","contact":{"name":"FluxVend Support","email":"support@fluxvend.com"},"license":{"name":"Apache 2.0","url":"http://springdoc.org"},"version":"0.0.1"},"servers":[{"url":"https://api.fluxvend.com","description":"Generated server url"}],"security":[{"JWT":["global","accessEverything"]}],"tags":[{"name":"Purchase Order","description":"API for managing purchase orders."}],"paths":{"/platform/purchase-order/api/v1":{"get":{"tags":["Purchase Order"],"summary":"Query Purchase Orders","description":"Query and filter purchase orders based on specific criteria.\n\nThis endpoint allows you to search for purchase orders based on various criteria, such as supplier, date, status, or other attributes.\n\nThe response will contain a list of purchase orders that match the specified criteria.\n","operationId":"queryPurchaseOrders","parameters":[{"name":"request","in":"query","description":"The criteria to filter and search purchase orders.\n\nThis can include supplier details, date range, status, or any other relevant attributes.\n\nThe response will contain a list of purchase orders that match the specified criteria.\n","required":true,"schema":{"type":"string","description":"The criteria to filter and search purchase orders.\n\nThis can include supplier details, date range, status, or any other relevant attributes.\n\nThe response will contain a list of purchase orders that match the specified criteria.\n"}}],"responses":{"200":{"description":"Successfully retrieved purchase orders.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"},"example":"{\n  totalCount: 1,\n  \"data\": [\n    {\n      \"externalRef\": \"EXT12345\",\n      \"supplier\": {\n        \"ref\": \"SUP12345\",\n        \"name\": \"Acme Corporation\",\n        \"email\": \"supplier@example.com\",\n        \"phone\": \"07034567890\",\n        \"address\": \"123 Main Street, Anytown, AN 12345, Country\"\n      },\n      \"vatRate\": 5.00,\n      \"dateOrdered\": \"2024-08-12T00:00:00Z\",\n      \"description\": \"Purchase order for office supplies.\"\n    }\n  ],\n    \"message\": \"Purchase orders retrieved successfully.\"\n}\n"}}},"400":{"description":"Invalid input or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"You do not have the necessary permissions to query purchase orders.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"An internal server error occurred while processing the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Purchase Order"],"summary":"Create New Purchase Order","description":"Create a new purchase order with the provided details.\n\nThis endpoint allows you to submit a new purchase order, including supplier information, items to be ordered, and any additional attributes.\n\nNote: The purchase order will be saved as a draft and will not be sent to the supplier until it is manually approved by an authorized user.\n\nThe purchase order will be processed and saved in the system.\n","operationId":"createPurchaseOrder","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftPurchaseOrder"}}},"required":true},"responses":{"200":{"description":"Successfully created purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"},"example":{"data":"PO000001","message":"Purchase order created successfully."}}}},"400":{"description":"Invalid input or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"You do not have the necessary permissions to create a purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"An internal server error occurred while processing the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/platform/purchase-order/api/v1/{ref}":{"get":{"tags":["Purchase Order"],"summary":"Get Purchase Order Details","description":"Retrieve the details of a specific purchase order.\n\nThis endpoint allows you to retrieve the details of a purchase order by providing its reference number.\n\nThe response will contain all the information related to the purchase order, including supplier details, items ordered, and status.\n","operationId":"getPurchaseOrderDetails","parameters":[{"name":"ref","in":"path","description":"The reference number of the purchase order to retrieve details for.\n\nThis reference should match either the system's internal reference or an external reference provided during creation.\n\nThis is used to uniquely identify the purchase order to retrieve details for.\n","required":true,"schema":{"type":"string","description":"The reference number of the purchase order to retrieve details for.\n\nThis reference should match either the system's internal reference or an external reference provided during creation.\n\nThis is used to uniquely identify the purchase order to retrieve details for.\n","example":"EXT12345"},"example":"EXT12345"}],"responses":{"200":{"description":"Successfully retrieved purchase order details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftPurchaseOrder"}}}},"400":{"description":"Invalid input or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"You do not have the necessary permissions to view purchase order details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The requested purchase order was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"An internal server error occurred while processing the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Purchase Order"],"summary":"Update Purchase Order","description":"Update an existing purchase order with the provided details.\n\nThis endpoint allows you to modify an existing purchase order, including supplier information, items to be ordered, and any additional attributes.\n\nNote: The purchase order must already exist in the system and be in a draft state to be updated.\n\nThe purchase order will be processed and saved in the system.\n","operationId":"updatePurchaseOrder","parameters":[{"name":"ref","in":"path","description":"The external reference number of the purchase order to be updated.\n\nThis reference should match either the system's internal reference or an external reference provided during creation.\n\nThis is used to uniquely identify the purchase order to be updated.\n","required":true,"schema":{"type":"string","description":"The external reference number of the purchase order to be updated.\n\nThis reference should match either the system's internal reference or an external reference provided during creation.\n\nThis is used to uniquely identify the purchase order to be updated.\n","example":"EXT12345"},"example":"EXT12345"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftPurchaseOrder"}}},"required":true},"responses":{"200":{"description":"Successfully updated purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponse"},"example":{"data":"PO000001","message":"Purchase order updated successfully."}}}},"400":{"description":"Invalid input or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"You do not have the necessary permissions to update a purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"An internal server error occurred while processing the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"Response":{"type":"object","properties":{"data":{"type":"object","description":"The main data of the response. The type of this data can vary.\nThis can be a simple type such as `String`, `Integer`, `Long`, `Double`, `Boolean`, List, Set, Map, or a custom object.\n\n","oneOf":[{"type":"string"},{"type":"integer","format":"int32"},{"type":"integer","format":"int64"},{"type":"number","format":"double"},{"type":"boolean"},{"type":"object"}]},"message":{"type":"string","description":"An optional message providing additional context or details about the response.\n\nThis message can be used to convey success, error details, or any other relevant information.\n","example":"Operation completed successfully."}},"description":"Standard response wrapper for API responses, containing the main data and an optional message."},"ErrorResponse":{"type":"object","properties":{"timestamp":{"type":"string","description":"Date/time of error","format":"date-time"},"message":{"type":"string","description":"Message describing the error"},"status":{"type":"integer","description":"Http status","format":"int32"},"code":{"type":"integer","description":"Code for identifying the cause of the server error","format":"int32"},"serverError":{"type":"string","description":"Enumeration of error codes used in the application.","enum":["99 INTERNAL","1004 NOT_FOUND","1002 BAD_REQUEST","1001 ALREADY_EXISTS","1003 NO_PERMISSION","4 INVALID_OPERATION","1003 UNAUTHORIZED","1004 USER_NOT_FOUND","1005 USER_ALREADY_EXISTS","1006 ROLE_NOT_FOUND","1007 ROLE_ALREADY_EXISTS","1008 PRIVILEGE_NOT_FOUND","1009 PRIVILEGE_ALREADY_EXISTS","1010 INVALID_GRANT_FORMAT","1011 INVALID_GRANT_CHARACTERS","1012 INVALID_GRANT_ACCESS","1013 CANNOT_DELETE_ROLES_IN_USE","1014 CANNOT_DELETE_PRIVILEGES_IN_USE","1015 CANNOT_DELETE_SYS_ROLE","1016 CANNOT_DELETE_SYS_PRIVILEGES","1017 CANNOT_DELETE_SELF","1018 ACCOUNT_DISABLED","1019 ACCOUNT_REGISTRATION_FAILED","1020 VALID_ACCOUNT_REQUIRED","1021 ACCOUNT_VERIFIED","1022 ACCOUNT_NOT_VERIFIED","1023 TENANT_NOT_FOUND","1024 TENANT_ALREADY_EXISTS","1025 TENANT_ID_EXISTS","1026 TENANT_NOT_ACTIVE","1027 TENANT_NOT_VERIFIED","1028 TENANT_NOT_APPROVED","1029 TENANT_NOT_REGISTERED","1030 TENANT_NAME_REQUIRED","1031 TENANT_EMAIL_REQUIRED","1032 TENANT_PHONE_REQUIRED","1033 TENANT_PRIMARY_ADMIN_USERNAME_REQUIRED","1034 TENANT_PRIMARY_ADMIN_PASSWORD_REQUIRED","1035 TENANT_KYC_ALREADY_VERIFIED","1036 TENANT_KYC_SCORE_TOO_LOW","1037 MISSING_REQUIRED_FIELDS","1038 SUBSCRIPTION_ALREADY_ACTIVE","1039 SUBSCRIPTION_NOT_INITIATED","1040 PAYMENT_VERIFICATION_FAILED","1041 NOT_AUTHORISED","1042 NO_ACTIVE_SUBSCRIPTION","1043 PENDING_PAYMENT","1044 NO_PAYMENT_CARD","1045 TOKEN_NOT_VALID","1046 TOKEN_EXPIRED","1047 SUBSCRIPTION_LIMIT_EXCEEDED","1048 INVITATION_NOT_FOUND","1049 INVITATION_EXPIRED","1050 INVITATION_ALREADY_ACCEPTED","1051 INVITATION_REVOKED","2001 SUPPLIER_NOT_FOUND","2002 STOCK_NOT_FOUND","2003 PRODUCT_NOT_FOUND","2004 STOCK_ALREADY_EXISTS","2005 SUPPLIER_ALREADY_EXISTS","2006 PRODUCT_ALREADY_EXISTS","2007 STOCK_QUANTITY_NOT_ENOUGH","2008 STOCK_QUANTITY_NOT_VALID","2009 STOCK_PRICE_NOT_VALID","2010 TERMINAL_DELETED","2011 DUPLICATE_REF"]},"path":{"type":"string","description":"Error path"}},"description":"Returned whenever an error occurs"},"DraftPurchaseOrder":{"required":["items","supplier"],"type":"object","properties":{"externalRef":{"type":"string","description":"A reference string that links this purchase order to an external system.\n\nThis field is useful for tracking the order in both your system and an external system.\n","example":"EXT12345"},"supplier":{"$ref":"#/components/schemas/DraftPurchaseOrderSupplier"},"vatRate":{"type":"number","description":"The VAT rate applicable to the purchase order.\n\nThis should be a decimal value representing the percentage rate (e.g., 5.00 for 5%).\n","example":5.0},"dateOrdered":{"type":"string","description":"The date when the purchase order was placed.\n\nThis field is important for tracking the timeline of the order and its subsequent processes.\n\nIf not provided, the current date and time will be used as the order date.\n","format":"date-time","example":"2024-08-12T00:00:00Z"},"description":{"type":"string","description":"A brief description or summary of the purchase order.\n\nThis can include details such as the purpose of the order or any special instructions.\n","example":"Purchase order for office supplies."},"items":{"type":"array","description":"A list of items included in the purchase order.\n\nEach item should include details such as product reference, quantity, unit price etc.\n","items":{"$ref":"#/components/schemas/DraftPurchaseOrderItem"}},"attributes":{"type":"object","additionalProperties":{"type":"string","description":"A map of additional attributes or metadata associated with the purchase order.\n\nThis can include any custom fields or notes that are relevant to the order.\n","example":"{'notes':'Urgent delivery', 'url':'http://example.com/details'}"},"description":"A map of additional attributes or metadata associated with the purchase order.\n\nThis can include any custom fields or notes that are relevant to the order.\n","example":"{'notes':'Urgent delivery', 'url':'http://example.com/details'}"}},"description":"Represents the data required to create a new purchase order in the system.\n\nThis includes details about the supplier, the items to be ordered, and any additional metadata or notes associated with the order.\n"},"DraftPurchaseOrderItem":{"required":["quantity","ref","unitPrice"],"type":"object","properties":{"ref":{"type":"string","description":"Unique product identifier used within the purchase order system.\n\nThis can be a product reference, SKU, barcode, or serial number.\n\nIt must correspond to a valid product in the inventory.\n"},"quantity":{"type":"integer","description":"Quantity of the product to be purchased.\n\nThis must be a positive integer.\n","format":"int32"},"uom":{"type":"string","description":"Unit of measurement for the product quantity.\n\nThis can be a standard unit of measurement like 'kg', 'litre', or 'unit', or a specific UOM reference.\n\nIf not provided, the default UOM for the product will be applied.\n"},"unitPrice":{"type":"number","description":"Price per unit of the product.\n\nThis should be a decimal value representing the cost per unit in the system's currency.\n"}},"description":"Details of a product in a draft purchase order."},"DraftPurchaseOrderSupplier":{"type":"object","properties":{"ref":{"type":"string","description":"The supplier's reference number as it appears in the admin's supplier list.\nThis reference is used to uniquely identify the supplier within the system.\nIf the supplier is not in the list or the reference is unknown, this field can be left blank,\nbut other identifying information (e.g., name, email, or phone) must be provided.\n","example":"SUP12345"},"name":{"type":"string","description":"The full name of the supplier.\nThis name should match the official or registered name of the supplier as used in correspondence or contracts.\n","example":"Acme Corporation"},"email":{"type":"string","description":"The email address of the supplier.\nThis is used for electronic communication, including sending purchase orders, queries, or other relevant information.\n","example":"supplier@example.com"},"phone":{"type":"string","description":"The phone number of the supplier.\nThis contact number is used for quick communication or follow-ups regarding the purchase order.\n","example":"07034567890"},"address":{"type":"string","description":"The physical address of the supplier.\nThis is used for shipping, billing, and other official communications.\n","example":"123 Main Street, Anytown, AN 12345, Country"}},"description":"Contains the details of the supplier associated with a draft purchase order.\nThis includes references, contact information, and address details, which are essential for processing and managing supplier relations within the system.\n","example":"{'ref':'SUP12345', 'name':'Acme Corporation', 'email':'supplier@example.com', 'phone':'07034567890', 'address':'123 Main Street, Anytown, AN 12345, Country'}"},"PurchaseOrderResponse":{"type":"object","properties":{"ref":{"type":"string"},"message":{"type":"string"}}},"QueryResponse":{"type":"object","properties":{"data":{"type":"array","description":"The main data of the response. The type of this data can vary.\nThis can be a simple type such as `String`, `Integer`, `Long`, `Double`, `Boolean`, List, Set, Map, or a custom object.\n\n","items":{"type":"object","description":"The main data of the response. The type of this data can vary.\nThis can be a simple type such as `String`, `Integer`, `Long`, `Double`, `Boolean`, List, Set, Map, or a custom object.\n\n","oneOf":[{"type":"string"},{"type":"integer","format":"int32"},{"type":"integer","format":"int64"},{"type":"number","format":"double"},{"type":"boolean"},{"type":"object"}]}},"message":{"type":"string","description":"An optional message providing additional context or details about the response.\n\nThis message can be used to convey success, error details, or any other relevant information.\n","example":"Operation completed successfully."},"totalCount":{"type":"integer","description":"The total number of records that match the query criteria.\nThis field helps in understanding the full size of the dataset,\neven when the data returned is paginated or filtered.\n","format":"int64","example":150},"summary":{"$ref":"#/components/schemas/ReportSummary"}},"description":"A response wrapper for paginated, filtered, or search queries.\nThis class extends the standard `Response` class to include a `totalCount` field,\nrepresenting the total number of records that match the query criteria.\n"},"ReportSummary":{"type":"object","properties":{"totalSales":{"type":"number","format":"double"},"totalRevenue":{"type":"number","format":"double"},"totalProfit":{"type":"number","format":"double"}}}},"securitySchemes":{"JWT":{"type":"apiKey","name":"Authorization","in":"header"}}}}