{"openapi":"3.0.0","info":{"title":"Holycat E-commerce API","version":"1.0.0","description":"API documentation for Holycat E-commerce Backend - A comprehensive e-commerce platform with authentication, product management, shopping cart, and order processing.","contact":{"name":"Holycat Team","url":"https://shop.holycat.id"}},"servers":[{"url":"http://localhost:4000","description":"Development server"},{"url":"https://shop.holycat.id","description":"Production server"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"cookieAuth":{"type":"apiKey","in":"cookie","name":"token"}},"schemas":{"User":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"role":{"type":"string","enum":["ADMIN","CUSTOMER"]},"city":{"type":"string"},"address":{"type":"string"},"phone":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"Product":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"description":{"type":"string"},"price":{"type":"number","format":"float"},"stock":{"type":"integer"},"image":{"type":"string"},"category":{"type":"string","enum":["Makanan_Kucing","Pasir_Kucing","Vitamin_Suplemen","Aksesoris","Produk_Lainnya"]},"createdAt":{"type":"string","format":"date-time"}}},"CartItem":{"type":"object","properties":{"id":{"type":"integer"},"userId":{"type":"integer"},"productId":{"type":"integer"},"quantity":{"type":"integer"},"product":{"$ref":"#/components/schemas/Product"}}},"Error":{"type":"object","properties":{"error":{"type":"string"}}}}},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"},{"name":"User","description":"User profile management"},{"name":"Products","description":"Product catalog and management"},{"name":"Cart","description":"Shopping cart operations"},{"name":"Shipping","description":"Shipping cost calculation"},{"name":"Orders","description":"Order management and processing"}],"paths":{"/orders/create":{"post":{"summary":"Create a new order","tags":["Orders"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["paymentMethod","cartItemIds","shippingCost"],"properties":{"paymentMethod":{"type":"string","enum":["COD","BANK_TRANSFER","HOLYPAY"]},"cartItemIds":{"type":"array","items":{"type":"integer"}},"shippingCost":{"type":"number"},"courierService":{"type":"string"}}}}}},"responses":{"201":{"description":"Order created successfully"},"400":{"description":"Invalid input"},"401":{"description":"Unauthorized"}}}},"/orders":{"get":{"summary":"Get all orders for authenticated user","tags":["Orders"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of user orders"},"401":{"description":"Unauthorized"}}}},"/orders/{id}":{"get":{"summary":"Get order by ID","tags":["Orders"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Order details"},"403":{"description":"Forbidden"},"404":{"description":"Order not found"}}}},"/orders/{id}/cancel":{"put":{"summary":"Cancel order (User only)","tags":["Orders"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Order cancelled successfully"},"400":{"description":"Cannot cancel order in current status"},"403":{"description":"Forbidden"},"404":{"description":"Order not found"}}}},"/orders/{id}/payment-proof":{"post":{"summary":"Upload payment proof for order","tags":["Orders"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["paymentProofUrl"],"properties":{"paymentProofUrl":{"type":"string"}}}}}},"responses":{"200":{"description":"Payment proof uploaded"},"400":{"description":"Invalid input"},"403":{"description":"Forbidden"}}}},"/payments/create":{"post":{"summary":"Create payment token from Midtrans","tags":["Payments"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orderId"],"properties":{"orderId":{"type":"integer","description":"ID of the order to pay","example":1}}}}}},"responses":{"200":{"description":"Payment token created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Midtrans Snap token"},"redirectUrl":{"type":"string","description":"Midtrans payment page URL"}}}}}},"400":{"description":"Order already paid"},"404":{"description":"Order not found"},"500":{"description":"Server error"}}}},"/payments/notify":{"post":{"summary":"Handle payment notification from Midtrans webhook","tags":["Payments"],"description":"This endpoint is called by Midtrans when payment status changes","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Midtrans notification payload"}}}},"responses":{"200":{"description":"Notification processed successfully"},"500":{"description":"Failed to process notification"}}}}}}