diff --git a/docs/docs.go b/docs/docs.go index 012d2f0..db60542 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -339,9 +339,9 @@ const docTemplate = `{ } } }, - "/api/v1/arifpay/b2c/transfer": { + "/api/v1/arifpay/b2c-webhook": { "post": { - "description": "Initiates a B2C transfer via Telebirr, CBE, or MPESA through Arifpay", + "description": "Handles webhook notifications from Arifpay for B2C transfers and updates transfer + wallet status.", "consumes": [ "application/json" ], @@ -351,22 +351,15 @@ const docTemplate = `{ "tags": [ "Arifpay" ], - "summary": "Initiate B2C Transfer", + "summary": "Handle Arifpay B2C Webhook", "parameters": [ { - "type": "string", - "description": "Transfer mode (Telebirr, CBE, MPESA)", - "name": "transfer_mode", - "in": "query", - "required": true - }, - { - "description": "Transfer request payload", + "description": "Arifpay webhook payload", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.ArifPayB2CRequest" + "$ref": "#/definitions/domain.WebhookRequest" } } ], @@ -383,8 +376,116 @@ const docTemplate = `{ "$ref": "#/definitions/domain.ErrorResponse" } }, - "502": { - "description": "Bad Gateway", + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/arifpay/b2c/transfer": { + "post": { + "description": "Initiates a B2C transfer using Telebirr, CBE, or MPESA depending on the \"type\" query parameter", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "Execute B2C Transfer", + "parameters": [ + { + "type": "string", + "description": "Transfer type (telebirr, cbe, mpesa)", + "name": "type", + "in": "query", + "required": true + }, + { + "description": "Transfer request payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ArifpayB2CRequest" + } + } + ], + "responses": { + "200": { + "description": "message: transfer executed successfully", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "400": { + "description": "error: invalid request or unsupported transfer type", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "error: internal server error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/arifpay/c2b-webhook": { + "post": { + "description": "Handles webhook notifications from Arifpay for C2B transfers and updates transfer + wallet status.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "Handle Arifpay C2B Webhook", + "parameters": [ + { + "description": "Arifpay webhook payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.WebhookRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.ErrorResponse" } @@ -412,7 +513,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CreateCheckoutSessionRequest" + "$ref": "#/definitions/domain.CheckoutSessionClientRequest" } } ], @@ -438,6 +539,73 @@ const docTemplate = `{ } } }, + "/api/v1/arifpay/checkout/{sessionId}/cancel": { + "post": { + "description": "Cancels a payment session using Arifpay before completion.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "Cancel Arifpay Checkout Session", + "parameters": [ + { + "type": "string", + "description": "Checkout session ID", + "name": "sessionId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/arifpay/payment-methods": { + "get": { + "description": "Returns all payment method IDs and names for Arifpay", + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "List Arifpay Payment Methods", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ARIFPAYPaymentMethod" + } + } + } + } + } + }, "/api/v1/arifpay/session-id/verify-transaction/{session_id}": { "get": { "description": "Verifies an Arifpay transaction using a session ID", @@ -528,7 +696,59 @@ const docTemplate = `{ } } }, - "/api/v1/auth/login": { + "/api/v1/auth/admin-login": { + "post": { + "description": "Login customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "summary": "Login customer", + "parameters": [ + { + "description": "Login admin", + "name": "login", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.loginAdminReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.loginAdminRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/auth/customer-login": { "post": { "description": "Login customer", "consumes": [ @@ -1379,6 +1599,44 @@ const docTemplate = `{ } } }, + "/api/v1/branchLocation": { + "get": { + "description": "Gets all branch locations", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "branch" + ], + "summary": "Gets all branch locations", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BranchLocation" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/branchWallet": { "get": { "description": "Retrieve all branch wallets", @@ -2473,6 +2731,130 @@ const docTemplate = `{ } } }, + "/api/v1/direct_deposit": { + "post": { + "description": "Customer initiates a direct deposit from mobile banking", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Direct Deposits" + ], + "summary": "Initiate a direct deposit", + "parameters": [ + { + "description": "Deposit details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.DirectDepositRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/direct_deposit/pending": { + "get": { + "description": "Get list of direct deposits needing verification", + "produces": [ + "application/json" + ], + "tags": [ + "Direct Deposits" + ], + "summary": "Get pending direct deposits", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/direct_deposit/verify": { + "post": { + "description": "Cashier verifies a direct deposit transaction", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Direct Deposits" + ], + "summary": "Verify a direct deposit", + "parameters": [ + { + "description": "Verification details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.VerifyDirectDepositRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, "/api/v1/events": { "get": { "description": "Retrieve all upcoming events from the database", @@ -2637,7 +3019,7 @@ const docTemplate = `{ }, "/api/v1/events/{id}/flag": { "put": { - "description": "Update the event flagged", + "description": "Update the event featured", "consumes": [ "application/json" ], @@ -2647,7 +3029,7 @@ const docTemplate = `{ "tags": [ "event" ], - "summary": "update the event flagged", + "summary": "update the event featured", "parameters": [ { "type": "integer", @@ -3929,6 +4311,52 @@ const docTemplate = `{ } } }, + "/api/v1/santimpay/payment": { + "post": { + "description": "Generates a payment URL using SantimPay and returns it to the client.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SantimPay" + ], + "summary": "Create SantimPay Payment Session", + "parameters": [ + { + "description": "SantimPay payment request payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.GeneratePaymentURLInput" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, "/api/v1/search/branch": { "get": { "description": "Search branches by name or location", @@ -4015,6 +4443,42 @@ const docTemplate = `{ } }, "/api/v1/shop/bet": { + "get": { + "description": "Gets all the shop bets", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "bet" + ], + "summary": "Gets all shop bets", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ShopBetRes" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, "post": { "description": "Create bet at branch", "consumes": [ @@ -4595,6 +5059,50 @@ const docTemplate = `{ } } }, + "/api/v1/sport/bet/fastcode/{fast_code}": { + "get": { + "description": "Gets a single bet by fast_code", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "bet" + ], + "summary": "Gets bet by fast_code", + "parameters": [ + { + "type": "integer", + "description": "Bet ID", + "name": "fast_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.BetRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/sport/bet/{id}": { "get": { "description": "Gets a single bet by id", @@ -4860,6 +5368,98 @@ const docTemplate = `{ } } }, + "/api/v1/telebirr/callback": { + "post": { + "description": "Processes the Telebirr payment result and updates wallet balance.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Telebirr" + ], + "summary": "Handle Telebirr Payment Callback", + "parameters": [ + { + "description": "Callback payload from Telebirr", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.TelebirrPaymentCallbackPayload" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/telebirr/payment": { + "post": { + "description": "Generates a payment URL using Telebirr and returns it to the client.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Telebirr" + ], + "summary": "Create Telebirr Payment Session", + "parameters": [ + { + "description": "Telebirr payment request payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.GeneratePaymentURLInput" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, "/api/v1/ticket": { "get": { "description": "Retrieve all tickets", @@ -5156,6 +5756,46 @@ const docTemplate = `{ } } }, + "/api/v1/user/admin-profile": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "Get user profile", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.AdminProfileRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/user/bets": { "get": { "description": "Gets user bets", @@ -5240,6 +5880,46 @@ const docTemplate = `{ } } }, + "/api/v1/user/customer-profile": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "Get user profile", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.CustomerProfileRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/user/delete/{id}": { "delete": { "description": "Delete a user by their ID", @@ -5284,46 +5964,6 @@ const docTemplate = `{ } } }, - "/api/v1/user/profile": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "Get user profile", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "user" - ], - "summary": "Get user profile", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/handlers.UserProfileRes" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - } - } - } - }, "/api/v1/user/register": { "post": { "description": "Register user", @@ -6511,6 +7151,17 @@ const docTemplate = `{ } }, "definitions": { + "domain.ARIFPAYPaymentMethod": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "domain.AleaPlayCallback": { "type": "object", "properties": { @@ -6559,13 +7210,24 @@ const docTemplate = `{ } } }, - "domain.ArifPayB2CRequest": { + "domain.ArifpayB2CRequest": { "type": "object", + "required": [ + "amount", + "customerEmail", + "customerPhone" + ], "properties": { "Phonenumber": { "type": "string" }, - "Sessionid": { + "amount": { + "type": "number" + }, + "customerEmail": { + "type": "string" + }, + "customerPhone": { "type": "string" } } @@ -6634,20 +7296,6 @@ const docTemplate = `{ } } }, - "domain.Beneficiary": { - "type": "object", - "properties": { - "accountNumber": { - "type": "string" - }, - "amount": { - "type": "number" - }, - "bank": { - "type": "string" - } - } - }, "domain.BetOutcome": { "type": "object", "properties": { @@ -6818,12 +7466,29 @@ const docTemplate = `{ "type": "string", "example": "4-kilo Branch" }, + "profit_percentage": { + "type": "number", + "example": 0.1 + }, "wallet_id": { "type": "integer", "example": 1 } } }, + "domain.BranchLocation": { + "type": "object", + "properties": { + "key": { + "type": "string", + "example": "addis_ababa" + }, + "name": { + "type": "string", + "example": "Addis Ababa" + } + } + }, "domain.BranchOperationRes": { "type": "object", "properties": { @@ -6868,6 +7533,10 @@ const docTemplate = `{ "type": "string", "example": "4-kilo Branch" }, + "profit_percentage": { + "type": "number", + "example": 0.1 + }, "wallet_id": { "type": "integer", "example": 1 @@ -6990,6 +7659,25 @@ const docTemplate = `{ } } }, + "domain.CheckoutSessionClientRequest": { + "type": "object", + "required": [ + "amount", + "customerEmail", + "customerPhone" + ], + "properties": { + "amount": { + "type": "number" + }, + "customerEmail": { + "type": "string" + }, + "customerPhone": { + "type": "string" + } + } + }, "domain.CompanyRes": { "type": "object", "properties": { @@ -7040,7 +7728,6 @@ const docTemplate = `{ "type": "object", "required": [ "amount", - "branch_id", "outcomes" ], "properties": { @@ -7125,56 +7812,10 @@ const docTemplate = `{ "items": { "type": "integer" } - } - } - }, - "domain.CreateCheckoutSessionRequest": { - "type": "object", - "properties": { - "beneficiaries": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.Beneficiary" - } }, - "cancelUrl": { - "type": "string" - }, - "email": { - "type": "string" - }, - "errorUrl": { - "type": "string" - }, - "expireDate": { - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.Item" - } - }, - "lang": { - "type": "string" - }, - "nonce": { - "type": "string" - }, - "notifyUrl": { - "type": "string" - }, - "paymentMethods": { - "type": "array", - "items": { - "type": "string" - } - }, - "phone": { - "type": "string" - }, - "successUrl": { - "type": "string" + "profit_percentage": { + "type": "number", + "example": 0.1 } } }, @@ -7185,6 +7826,10 @@ const docTemplate = `{ "type": "integer", "example": 1 }, + "deducted_percentage": { + "type": "number", + "example": 0.1 + }, "name": { "type": "string", "example": "CompanyName" @@ -7392,6 +8037,29 @@ const docTemplate = `{ } } }, + "domain.DirectDepositRequest": { + "type": "object", + "required": [ + "amount", + "bank_reference", + "customer_id", + "sender_account" + ], + "properties": { + "amount": { + "type": "integer" + }, + "bank_reference": { + "type": "string" + }, + "customer_id": { + "type": "integer" + }, + "sender_account": { + "type": "string" + } + } + }, "domain.ErrorResponse": { "type": "object", "properties": { @@ -7667,6 +8335,23 @@ const docTemplate = `{ } } }, + "domain.GeneratePaymentURLInput": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "phoneNumber": { + "type": "string" + }, + "reason": { + "type": "string" + } + } + }, "domain.GetCompanyRes": { "type": "object", "properties": { @@ -7738,26 +8423,6 @@ const docTemplate = `{ } } }, - "domain.Item": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "image": { - "type": "string" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - }, - "quantity": { - "type": "integer" - } - } - }, "domain.League": { "type": "object", "properties": { @@ -8308,6 +8973,82 @@ const docTemplate = `{ } } }, + "domain.ShopBetRes": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "bet_id": { + "type": "integer", + "example": 1 + }, + "branch_id": { + "type": "integer", + "example": 2 + }, + "cashed_out": { + "type": "boolean", + "example": false + }, + "cashout_id": { + "type": "string", + "example": "21234" + }, + "company_id": { + "type": "integer", + "example": 2 + }, + "created_at": { + "type": "string", + "example": "2025-04-08T12:00:00Z" + }, + "full_name": { + "type": "string", + "example": "John" + }, + "id": { + "type": "integer" + }, + "number_of_outcomes": { + "type": "integer", + "example": 1 + }, + "outcomes": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BetOutcome" + } + }, + "phone_number": { + "type": "string", + "example": "1234567890" + }, + "shop_transaction_id": { + "type": "integer" + }, + "status": { + "allOf": [ + { + "$ref": "#/definitions/domain.OutcomeStatus" + } + ], + "example": 1 + }, + "total_odds": { + "type": "number", + "example": 4.22 + }, + "transaction_verified": { + "type": "boolean", + "example": true + }, + "updated_at": { + "type": "string", + "example": "2025-04-08T12:00:00Z" + } + } + }, "domain.ShopDepositReq": { "type": "object", "properties": { @@ -8493,6 +9234,67 @@ const docTemplate = `{ } } }, + "domain.TelebirrPaymentCallbackPayload": { + "type": "object", + "properties": { + "appid": { + "description": "App ID provided by Telebirr", + "type": "string" + }, + "callback_info": { + "description": "Optional merchant-defined callback data", + "type": "string" + }, + "merch_code": { + "description": "Merchant short code", + "type": "string" + }, + "merch_order_id": { + "description": "Order ID from merchant system", + "type": "string" + }, + "notify_time": { + "description": "Notification timestamp (UTC, in seconds)", + "type": "string" + }, + "notify_url": { + "description": "Optional callback URL", + "type": "string" + }, + "payment_order_id": { + "description": "Order ID from Telebirr system", + "type": "string" + }, + "sign": { + "description": "Signature of the payload", + "type": "string" + }, + "sign_type": { + "description": "Signature type, e.g., SHA256WithRSA", + "type": "string" + }, + "total_amount": { + "description": "Payment amount", + "type": "string" + }, + "trade_status": { + "description": "Payment status (e.g., Completed, Failure)", + "type": "string" + }, + "trans_currency": { + "description": "Currency type (e.g., ETB)", + "type": "string" + }, + "trans_end_time": { + "description": "Transaction end time (UTC seconds)", + "type": "string" + }, + "trans_id": { + "description": "Transaction ID", + "type": "string" + } + } + }, "domain.TicketOutcome": { "type": "object", "properties": { @@ -8596,10 +9398,6 @@ const docTemplate = `{ "description": "Away team ID (can be empty/null)", "type": "integer" }, - "flagged": { - "description": "Whether the event is flagged or not", - "type": "boolean" - }, "home_kit_image": { "description": "Kit or image for home team (optional)", "type": "string" @@ -8616,6 +9414,14 @@ const docTemplate = `{ "description": "Event ID", "type": "string" }, + "is_active": { + "description": "Whether the event is featured or not", + "type": "boolean" + }, + "is_featured": { + "description": "Whether the event is featured or not", + "type": "boolean" + }, "league_cc": { "description": "League country code", "type": "string" @@ -8684,6 +9490,108 @@ const docTemplate = `{ } } }, + "domain.VerifyDirectDepositRequest": { + "type": "object", + "required": [ + "deposit_id", + "is_verified" + ], + "properties": { + "deposit_id": { + "type": "integer" + }, + "is_verified": { + "type": "boolean" + }, + "notes": { + "type": "string" + } + } + }, + "domain.WebhookRequest": { + "type": "object", + "properties": { + "nonce": { + "type": "string" + }, + "notificationUrl": { + "type": "string" + }, + "paymentMethod": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "sessionId": { + "type": "string" + }, + "totalAmount": { + "type": "integer" + }, + "transaction": { + "type": "object", + "properties": { + "transactionId": { + "type": "string" + }, + "transactionStatus": { + "type": "string" + } + } + }, + "transactionStatus": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "handlers.AdminProfileRes": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "first_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "last_login": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "phone_verified": { + "type": "boolean" + }, + "role": { + "$ref": "#/definitions/domain.Role" + }, + "suspended": { + "type": "boolean" + }, + "suspended_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "handlers.AdminRes": { "type": "object", "properties": { @@ -8856,6 +9764,53 @@ const docTemplate = `{ } } }, + "handlers.CustomerProfileRes": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "first_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "last_login": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "phone_verified": { + "type": "boolean" + }, + "referral_code": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/domain.Role" + }, + "suspended": { + "type": "boolean" + }, + "suspended_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "handlers.CustomerWalletRes": { "type": "object", "properties": { @@ -9333,6 +10288,9 @@ const docTemplate = `{ "phone_verified": { "type": "boolean" }, + "referral_code": { + "type": "string" + }, "role": { "$ref": "#/definitions/domain.Role" }, @@ -9420,6 +10378,40 @@ const docTemplate = `{ } } }, + "handlers.loginAdminReq": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "email": { + "type": "string", + "example": "john.doe@example.com" + }, + "password": { + "type": "string", + "example": "password123" + }, + "phone_number": { + "type": "string", + "example": "1234567890" + } + } + }, + "handlers.loginAdminRes": { + "type": "object", + "properties": { + "access_token": { + "type": "string" + }, + "refresh_token": { + "type": "string" + }, + "role": { + "type": "string" + } + } + }, "handlers.loginCustomerReq": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index f65862a..efe4771 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -331,9 +331,9 @@ } } }, - "/api/v1/arifpay/b2c/transfer": { + "/api/v1/arifpay/b2c-webhook": { "post": { - "description": "Initiates a B2C transfer via Telebirr, CBE, or MPESA through Arifpay", + "description": "Handles webhook notifications from Arifpay for B2C transfers and updates transfer + wallet status.", "consumes": [ "application/json" ], @@ -343,22 +343,15 @@ "tags": [ "Arifpay" ], - "summary": "Initiate B2C Transfer", + "summary": "Handle Arifpay B2C Webhook", "parameters": [ { - "type": "string", - "description": "Transfer mode (Telebirr, CBE, MPESA)", - "name": "transfer_mode", - "in": "query", - "required": true - }, - { - "description": "Transfer request payload", + "description": "Arifpay webhook payload", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.ArifPayB2CRequest" + "$ref": "#/definitions/domain.WebhookRequest" } } ], @@ -375,8 +368,116 @@ "$ref": "#/definitions/domain.ErrorResponse" } }, - "502": { - "description": "Bad Gateway", + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/arifpay/b2c/transfer": { + "post": { + "description": "Initiates a B2C transfer using Telebirr, CBE, or MPESA depending on the \"type\" query parameter", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "Execute B2C Transfer", + "parameters": [ + { + "type": "string", + "description": "Transfer type (telebirr, cbe, mpesa)", + "name": "type", + "in": "query", + "required": true + }, + { + "description": "Transfer request payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ArifpayB2CRequest" + } + } + ], + "responses": { + "200": { + "description": "message: transfer executed successfully", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "400": { + "description": "error: invalid request or unsupported transfer type", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "error: internal server error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/arifpay/c2b-webhook": { + "post": { + "description": "Handles webhook notifications from Arifpay for C2B transfers and updates transfer + wallet status.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "Handle Arifpay C2B Webhook", + "parameters": [ + { + "description": "Arifpay webhook payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.WebhookRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.ErrorResponse" } @@ -404,7 +505,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CreateCheckoutSessionRequest" + "$ref": "#/definitions/domain.CheckoutSessionClientRequest" } } ], @@ -430,6 +531,73 @@ } } }, + "/api/v1/arifpay/checkout/{sessionId}/cancel": { + "post": { + "description": "Cancels a payment session using Arifpay before completion.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "Cancel Arifpay Checkout Session", + "parameters": [ + { + "type": "string", + "description": "Checkout session ID", + "name": "sessionId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/arifpay/payment-methods": { + "get": { + "description": "Returns all payment method IDs and names for Arifpay", + "produces": [ + "application/json" + ], + "tags": [ + "Arifpay" + ], + "summary": "List Arifpay Payment Methods", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ARIFPAYPaymentMethod" + } + } + } + } + } + }, "/api/v1/arifpay/session-id/verify-transaction/{session_id}": { "get": { "description": "Verifies an Arifpay transaction using a session ID", @@ -520,7 +688,59 @@ } } }, - "/api/v1/auth/login": { + "/api/v1/auth/admin-login": { + "post": { + "description": "Login customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "summary": "Login customer", + "parameters": [ + { + "description": "Login admin", + "name": "login", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.loginAdminReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.loginAdminRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/auth/customer-login": { "post": { "description": "Login customer", "consumes": [ @@ -1371,6 +1591,44 @@ } } }, + "/api/v1/branchLocation": { + "get": { + "description": "Gets all branch locations", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "branch" + ], + "summary": "Gets all branch locations", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BranchLocation" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/branchWallet": { "get": { "description": "Retrieve all branch wallets", @@ -2465,6 +2723,130 @@ } } }, + "/api/v1/direct_deposit": { + "post": { + "description": "Customer initiates a direct deposit from mobile banking", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Direct Deposits" + ], + "summary": "Initiate a direct deposit", + "parameters": [ + { + "description": "Deposit details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.DirectDepositRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/direct_deposit/pending": { + "get": { + "description": "Get list of direct deposits needing verification", + "produces": [ + "application/json" + ], + "tags": [ + "Direct Deposits" + ], + "summary": "Get pending direct deposits", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/direct_deposit/verify": { + "post": { + "description": "Cashier verifies a direct deposit transaction", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Direct Deposits" + ], + "summary": "Verify a direct deposit", + "parameters": [ + { + "description": "Verification details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.VerifyDirectDepositRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, "/api/v1/events": { "get": { "description": "Retrieve all upcoming events from the database", @@ -2629,7 +3011,7 @@ }, "/api/v1/events/{id}/flag": { "put": { - "description": "Update the event flagged", + "description": "Update the event featured", "consumes": [ "application/json" ], @@ -2639,7 +3021,7 @@ "tags": [ "event" ], - "summary": "update the event flagged", + "summary": "update the event featured", "parameters": [ { "type": "integer", @@ -3921,6 +4303,52 @@ } } }, + "/api/v1/santimpay/payment": { + "post": { + "description": "Generates a payment URL using SantimPay and returns it to the client.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SantimPay" + ], + "summary": "Create SantimPay Payment Session", + "parameters": [ + { + "description": "SantimPay payment request payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.GeneratePaymentURLInput" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, "/api/v1/search/branch": { "get": { "description": "Search branches by name or location", @@ -4007,6 +4435,42 @@ } }, "/api/v1/shop/bet": { + "get": { + "description": "Gets all the shop bets", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "bet" + ], + "summary": "Gets all shop bets", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ShopBetRes" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, "post": { "description": "Create bet at branch", "consumes": [ @@ -4587,6 +5051,50 @@ } } }, + "/api/v1/sport/bet/fastcode/{fast_code}": { + "get": { + "description": "Gets a single bet by fast_code", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "bet" + ], + "summary": "Gets bet by fast_code", + "parameters": [ + { + "type": "integer", + "description": "Bet ID", + "name": "fast_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.BetRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/sport/bet/{id}": { "get": { "description": "Gets a single bet by id", @@ -4852,6 +5360,98 @@ } } }, + "/api/v1/telebirr/callback": { + "post": { + "description": "Processes the Telebirr payment result and updates wallet balance.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Telebirr" + ], + "summary": "Handle Telebirr Payment Callback", + "parameters": [ + { + "description": "Callback payload from Telebirr", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.TelebirrPaymentCallbackPayload" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, + "/api/v1/telebirr/payment": { + "post": { + "description": "Generates a payment URL using Telebirr and returns it to the client.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Telebirr" + ], + "summary": "Create Telebirr Payment Session", + "parameters": [ + { + "description": "Telebirr payment request payload", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.GeneratePaymentURLInput" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/domain.ErrorResponse" + } + } + } + } + }, "/api/v1/ticket": { "get": { "description": "Retrieve all tickets", @@ -5148,6 +5748,46 @@ } } }, + "/api/v1/user/admin-profile": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "Get user profile", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.AdminProfileRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/user/bets": { "get": { "description": "Gets user bets", @@ -5232,6 +5872,46 @@ } } }, + "/api/v1/user/customer-profile": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "Get user profile", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get user profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.CustomerProfileRes" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/user/delete/{id}": { "delete": { "description": "Delete a user by their ID", @@ -5276,46 +5956,6 @@ } } }, - "/api/v1/user/profile": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "Get user profile", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "user" - ], - "summary": "Get user profile", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/handlers.UserProfileRes" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - } - } - } - }, "/api/v1/user/register": { "post": { "description": "Register user", @@ -6503,6 +7143,17 @@ } }, "definitions": { + "domain.ARIFPAYPaymentMethod": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "domain.AleaPlayCallback": { "type": "object", "properties": { @@ -6551,13 +7202,24 @@ } } }, - "domain.ArifPayB2CRequest": { + "domain.ArifpayB2CRequest": { "type": "object", + "required": [ + "amount", + "customerEmail", + "customerPhone" + ], "properties": { "Phonenumber": { "type": "string" }, - "Sessionid": { + "amount": { + "type": "number" + }, + "customerEmail": { + "type": "string" + }, + "customerPhone": { "type": "string" } } @@ -6626,20 +7288,6 @@ } } }, - "domain.Beneficiary": { - "type": "object", - "properties": { - "accountNumber": { - "type": "string" - }, - "amount": { - "type": "number" - }, - "bank": { - "type": "string" - } - } - }, "domain.BetOutcome": { "type": "object", "properties": { @@ -6810,12 +7458,29 @@ "type": "string", "example": "4-kilo Branch" }, + "profit_percentage": { + "type": "number", + "example": 0.1 + }, "wallet_id": { "type": "integer", "example": 1 } } }, + "domain.BranchLocation": { + "type": "object", + "properties": { + "key": { + "type": "string", + "example": "addis_ababa" + }, + "name": { + "type": "string", + "example": "Addis Ababa" + } + } + }, "domain.BranchOperationRes": { "type": "object", "properties": { @@ -6860,6 +7525,10 @@ "type": "string", "example": "4-kilo Branch" }, + "profit_percentage": { + "type": "number", + "example": 0.1 + }, "wallet_id": { "type": "integer", "example": 1 @@ -6982,6 +7651,25 @@ } } }, + "domain.CheckoutSessionClientRequest": { + "type": "object", + "required": [ + "amount", + "customerEmail", + "customerPhone" + ], + "properties": { + "amount": { + "type": "number" + }, + "customerEmail": { + "type": "string" + }, + "customerPhone": { + "type": "string" + } + } + }, "domain.CompanyRes": { "type": "object", "properties": { @@ -7032,7 +7720,6 @@ "type": "object", "required": [ "amount", - "branch_id", "outcomes" ], "properties": { @@ -7117,56 +7804,10 @@ "items": { "type": "integer" } - } - } - }, - "domain.CreateCheckoutSessionRequest": { - "type": "object", - "properties": { - "beneficiaries": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.Beneficiary" - } }, - "cancelUrl": { - "type": "string" - }, - "email": { - "type": "string" - }, - "errorUrl": { - "type": "string" - }, - "expireDate": { - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.Item" - } - }, - "lang": { - "type": "string" - }, - "nonce": { - "type": "string" - }, - "notifyUrl": { - "type": "string" - }, - "paymentMethods": { - "type": "array", - "items": { - "type": "string" - } - }, - "phone": { - "type": "string" - }, - "successUrl": { - "type": "string" + "profit_percentage": { + "type": "number", + "example": 0.1 } } }, @@ -7177,6 +7818,10 @@ "type": "integer", "example": 1 }, + "deducted_percentage": { + "type": "number", + "example": 0.1 + }, "name": { "type": "string", "example": "CompanyName" @@ -7384,6 +8029,29 @@ } } }, + "domain.DirectDepositRequest": { + "type": "object", + "required": [ + "amount", + "bank_reference", + "customer_id", + "sender_account" + ], + "properties": { + "amount": { + "type": "integer" + }, + "bank_reference": { + "type": "string" + }, + "customer_id": { + "type": "integer" + }, + "sender_account": { + "type": "string" + } + } + }, "domain.ErrorResponse": { "type": "object", "properties": { @@ -7659,6 +8327,23 @@ } } }, + "domain.GeneratePaymentURLInput": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "phoneNumber": { + "type": "string" + }, + "reason": { + "type": "string" + } + } + }, "domain.GetCompanyRes": { "type": "object", "properties": { @@ -7730,26 +8415,6 @@ } } }, - "domain.Item": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "image": { - "type": "string" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - }, - "quantity": { - "type": "integer" - } - } - }, "domain.League": { "type": "object", "properties": { @@ -8300,6 +8965,82 @@ } } }, + "domain.ShopBetRes": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "bet_id": { + "type": "integer", + "example": 1 + }, + "branch_id": { + "type": "integer", + "example": 2 + }, + "cashed_out": { + "type": "boolean", + "example": false + }, + "cashout_id": { + "type": "string", + "example": "21234" + }, + "company_id": { + "type": "integer", + "example": 2 + }, + "created_at": { + "type": "string", + "example": "2025-04-08T12:00:00Z" + }, + "full_name": { + "type": "string", + "example": "John" + }, + "id": { + "type": "integer" + }, + "number_of_outcomes": { + "type": "integer", + "example": 1 + }, + "outcomes": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BetOutcome" + } + }, + "phone_number": { + "type": "string", + "example": "1234567890" + }, + "shop_transaction_id": { + "type": "integer" + }, + "status": { + "allOf": [ + { + "$ref": "#/definitions/domain.OutcomeStatus" + } + ], + "example": 1 + }, + "total_odds": { + "type": "number", + "example": 4.22 + }, + "transaction_verified": { + "type": "boolean", + "example": true + }, + "updated_at": { + "type": "string", + "example": "2025-04-08T12:00:00Z" + } + } + }, "domain.ShopDepositReq": { "type": "object", "properties": { @@ -8485,6 +9226,67 @@ } } }, + "domain.TelebirrPaymentCallbackPayload": { + "type": "object", + "properties": { + "appid": { + "description": "App ID provided by Telebirr", + "type": "string" + }, + "callback_info": { + "description": "Optional merchant-defined callback data", + "type": "string" + }, + "merch_code": { + "description": "Merchant short code", + "type": "string" + }, + "merch_order_id": { + "description": "Order ID from merchant system", + "type": "string" + }, + "notify_time": { + "description": "Notification timestamp (UTC, in seconds)", + "type": "string" + }, + "notify_url": { + "description": "Optional callback URL", + "type": "string" + }, + "payment_order_id": { + "description": "Order ID from Telebirr system", + "type": "string" + }, + "sign": { + "description": "Signature of the payload", + "type": "string" + }, + "sign_type": { + "description": "Signature type, e.g., SHA256WithRSA", + "type": "string" + }, + "total_amount": { + "description": "Payment amount", + "type": "string" + }, + "trade_status": { + "description": "Payment status (e.g., Completed, Failure)", + "type": "string" + }, + "trans_currency": { + "description": "Currency type (e.g., ETB)", + "type": "string" + }, + "trans_end_time": { + "description": "Transaction end time (UTC seconds)", + "type": "string" + }, + "trans_id": { + "description": "Transaction ID", + "type": "string" + } + } + }, "domain.TicketOutcome": { "type": "object", "properties": { @@ -8588,10 +9390,6 @@ "description": "Away team ID (can be empty/null)", "type": "integer" }, - "flagged": { - "description": "Whether the event is flagged or not", - "type": "boolean" - }, "home_kit_image": { "description": "Kit or image for home team (optional)", "type": "string" @@ -8608,6 +9406,14 @@ "description": "Event ID", "type": "string" }, + "is_active": { + "description": "Whether the event is featured or not", + "type": "boolean" + }, + "is_featured": { + "description": "Whether the event is featured or not", + "type": "boolean" + }, "league_cc": { "description": "League country code", "type": "string" @@ -8676,6 +9482,108 @@ } } }, + "domain.VerifyDirectDepositRequest": { + "type": "object", + "required": [ + "deposit_id", + "is_verified" + ], + "properties": { + "deposit_id": { + "type": "integer" + }, + "is_verified": { + "type": "boolean" + }, + "notes": { + "type": "string" + } + } + }, + "domain.WebhookRequest": { + "type": "object", + "properties": { + "nonce": { + "type": "string" + }, + "notificationUrl": { + "type": "string" + }, + "paymentMethod": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "sessionId": { + "type": "string" + }, + "totalAmount": { + "type": "integer" + }, + "transaction": { + "type": "object", + "properties": { + "transactionId": { + "type": "string" + }, + "transactionStatus": { + "type": "string" + } + } + }, + "transactionStatus": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "handlers.AdminProfileRes": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "first_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "last_login": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "phone_verified": { + "type": "boolean" + }, + "role": { + "$ref": "#/definitions/domain.Role" + }, + "suspended": { + "type": "boolean" + }, + "suspended_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "handlers.AdminRes": { "type": "object", "properties": { @@ -8848,6 +9756,53 @@ } } }, + "handlers.CustomerProfileRes": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + }, + "first_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "last_login": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "phone_verified": { + "type": "boolean" + }, + "referral_code": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/domain.Role" + }, + "suspended": { + "type": "boolean" + }, + "suspended_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "handlers.CustomerWalletRes": { "type": "object", "properties": { @@ -9325,6 +10280,9 @@ "phone_verified": { "type": "boolean" }, + "referral_code": { + "type": "string" + }, "role": { "$ref": "#/definitions/domain.Role" }, @@ -9412,6 +10370,40 @@ } } }, + "handlers.loginAdminReq": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "email": { + "type": "string", + "example": "john.doe@example.com" + }, + "password": { + "type": "string", + "example": "password123" + }, + "phone_number": { + "type": "string", + "example": "1234567890" + } + } + }, + "handlers.loginAdminRes": { + "type": "object", + "properties": { + "access_token": { + "type": "string" + }, + "refresh_token": { + "type": "string" + }, + "role": { + "type": "string" + } + } + }, "handlers.loginCustomerReq": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2cd514d..ca80f28 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,11 @@ definitions: + domain.ARIFPAYPaymentMethod: + properties: + id: + type: integer + name: + type: string + type: object domain.AleaPlayCallback: properties: amount: @@ -31,12 +38,20 @@ definitions: user_id: type: string type: object - domain.ArifPayB2CRequest: + domain.ArifpayB2CRequest: properties: Phonenumber: type: string - Sessionid: + amount: + type: number + customerEmail: type: string + customerPhone: + type: string + required: + - amount + - customerEmail + - customerPhone type: object domain.ArifpayVerifyByTransactionIDRequest: properties: @@ -81,15 +96,6 @@ definitions: updated_at: type: string type: object - domain.Beneficiary: - properties: - accountNumber: - type: string - amount: - type: number - bank: - type: string - type: object domain.BetOutcome: properties: away_team_name: @@ -211,10 +217,22 @@ definitions: name: example: 4-kilo Branch type: string + profit_percentage: + example: 0.1 + type: number wallet_id: example: 1 type: integer type: object + domain.BranchLocation: + properties: + key: + example: addis_ababa + type: string + name: + example: Addis Ababa + type: string + type: object domain.BranchOperationRes: properties: description: @@ -247,6 +265,9 @@ definitions: name: example: 4-kilo Branch type: string + profit_percentage: + example: 0.1 + type: number wallet_id: example: 1 type: integer @@ -326,6 +347,19 @@ definitions: reference: type: string type: object + domain.CheckoutSessionClientRequest: + properties: + amount: + type: number + customerEmail: + type: string + customerPhone: + type: string + required: + - amount + - customerEmail + - customerPhone + type: object domain.CompanyRes: properties: admin_id: @@ -373,7 +407,6 @@ definitions: type: array required: - amount - - branch_id - outcomes type: object domain.CreateBetWithFastCodeReq: @@ -419,50 +452,23 @@ definitions: items: type: integer type: array + profit_percentage: + example: 0.1 + type: number required: - branch_manager_id - location - name - operations type: object - domain.CreateCheckoutSessionRequest: - properties: - beneficiaries: - items: - $ref: '#/definitions/domain.Beneficiary' - type: array - cancelUrl: - type: string - email: - type: string - errorUrl: - type: string - expireDate: - type: string - items: - items: - $ref: '#/definitions/domain.Item' - type: array - lang: - type: string - nonce: - type: string - notifyUrl: - type: string - paymentMethods: - items: - type: string - type: array - phone: - type: string - successUrl: - type: string - type: object domain.CreateCompanyReq: properties: admin_id: example: 1 type: integer + deducted_percentage: + example: 0.1 + type: number name: example: CompanyName type: string @@ -602,6 +608,22 @@ definitions: providerId: type: string type: object + domain.DirectDepositRequest: + properties: + amount: + type: integer + bank_reference: + type: string + customer_id: + type: integer + sender_account: + type: string + required: + - amount + - bank_reference + - customer_id + - sender_account + type: object domain.ErrorResponse: properties: error: @@ -794,6 +816,17 @@ definitions: meta: $ref: '#/definitions/domain.PaginationMeta' type: object + domain.GeneratePaymentURLInput: + properties: + amount: + type: integer + id: + type: string + phoneNumber: + type: string + reason: + type: string + type: object domain.GetCompanyRes: properties: admin_first_name: @@ -843,19 +876,6 @@ definitions: status: type: string type: object - domain.Item: - properties: - description: - type: string - image: - type: string - name: - type: string - price: - type: number - quantity: - type: integer - type: object domain.League: properties: bet365_id: @@ -1233,6 +1253,59 @@ definitions: reference_number: type: string type: object + domain.ShopBetRes: + properties: + amount: + type: integer + bet_id: + example: 1 + type: integer + branch_id: + example: 2 + type: integer + cashed_out: + example: false + type: boolean + cashout_id: + example: "21234" + type: string + company_id: + example: 2 + type: integer + created_at: + example: "2025-04-08T12:00:00Z" + type: string + full_name: + example: John + type: string + id: + type: integer + number_of_outcomes: + example: 1 + type: integer + outcomes: + items: + $ref: '#/definitions/domain.BetOutcome' + type: array + phone_number: + example: "1234567890" + type: string + shop_transaction_id: + type: integer + status: + allOf: + - $ref: '#/definitions/domain.OutcomeStatus' + example: 1 + total_odds: + example: 4.22 + type: number + transaction_verified: + example: true + type: boolean + updated_at: + example: "2025-04-08T12:00:00Z" + type: string + type: object domain.ShopDepositReq: properties: account_name: @@ -1363,6 +1436,51 @@ definitions: example: SportsBook type: string type: object + domain.TelebirrPaymentCallbackPayload: + properties: + appid: + description: App ID provided by Telebirr + type: string + callback_info: + description: Optional merchant-defined callback data + type: string + merch_code: + description: Merchant short code + type: string + merch_order_id: + description: Order ID from merchant system + type: string + notify_time: + description: Notification timestamp (UTC, in seconds) + type: string + notify_url: + description: Optional callback URL + type: string + payment_order_id: + description: Order ID from Telebirr system + type: string + sign: + description: Signature of the payload + type: string + sign_type: + description: Signature type, e.g., SHA256WithRSA + type: string + total_amount: + description: Payment amount + type: string + trade_status: + description: Payment status (e.g., Completed, Failure) + type: string + trans_currency: + description: Currency type (e.g., ETB) + type: string + trans_end_time: + description: Transaction end time (UTC seconds) + type: string + trans_id: + description: Transaction ID + type: string + type: object domain.TicketOutcome: properties: away_team_name: @@ -1436,9 +1554,6 @@ definitions: away_team_id: description: Away team ID (can be empty/null) type: integer - flagged: - description: Whether the event is flagged or not - type: boolean home_kit_image: description: Kit or image for home team (optional) type: string @@ -1451,6 +1566,12 @@ definitions: id: description: Event ID type: string + is_active: + description: Whether the event is featured or not + type: boolean + is_featured: + description: Whether the event is featured or not + type: boolean league_cc: description: League country code type: string @@ -1498,6 +1619,73 @@ definitions: example: true type: boolean type: object + domain.VerifyDirectDepositRequest: + properties: + deposit_id: + type: integer + is_verified: + type: boolean + notes: + type: string + required: + - deposit_id + - is_verified + type: object + domain.WebhookRequest: + properties: + nonce: + type: string + notificationUrl: + type: string + paymentMethod: + type: string + phone: + type: string + sessionId: + type: string + totalAmount: + type: integer + transaction: + properties: + transactionId: + type: string + transactionStatus: + type: string + type: object + transactionStatus: + type: string + uuid: + type: string + type: object + handlers.AdminProfileRes: + properties: + created_at: + type: string + email: + type: string + email_verified: + type: boolean + first_name: + type: string + id: + type: integer + last_login: + type: string + last_name: + type: string + phone_number: + type: string + phone_verified: + type: boolean + role: + $ref: '#/definitions/domain.Role' + suspended: + type: boolean + suspended_at: + type: string + updated_at: + type: string + type: object handlers.AdminRes: properties: created_at: @@ -1618,6 +1806,37 @@ definitions: example: cash type: string type: object + handlers.CustomerProfileRes: + properties: + created_at: + type: string + email: + type: string + email_verified: + type: boolean + first_name: + type: string + id: + type: integer + last_login: + type: string + last_name: + type: string + phone_number: + type: string + phone_verified: + type: boolean + referral_code: + type: string + role: + $ref: '#/definitions/domain.Role' + suspended: + type: boolean + suspended_at: + type: string + updated_at: + type: string + type: object handlers.CustomerWalletRes: properties: created_at: @@ -1941,6 +2160,8 @@ definitions: type: string phone_verified: type: boolean + referral_code: + type: string role: $ref: '#/definitions/domain.Role' suspended: @@ -2002,6 +2223,29 @@ definitions: launch_url: type: string type: object + handlers.loginAdminReq: + properties: + email: + example: john.doe@example.com + type: string + password: + example: password123 + type: string + phone_number: + example: "1234567890" + type: string + required: + - password + type: object + handlers.loginAdminRes: + properties: + access_token: + type: string + refresh_token: + type: string + role: + type: string + type: object handlers.loginCustomerReq: properties: email: @@ -2343,23 +2587,19 @@ paths: summary: Launch an Alea Play virtual game tags: - Alea Virtual Games - /api/v1/arifpay/b2c/transfer: + /api/v1/arifpay/b2c-webhook: post: consumes: - application/json - description: Initiates a B2C transfer via Telebirr, CBE, or MPESA through Arifpay + description: Handles webhook notifications from Arifpay for B2C transfers and + updates transfer + wallet status. parameters: - - description: Transfer mode (Telebirr, CBE, MPESA) - in: query - name: transfer_mode - required: true - type: string - - description: Transfer request payload + - description: Arifpay webhook payload in: body name: request required: true schema: - $ref: '#/definitions/domain.ArifPayB2CRequest' + $ref: '#/definitions/domain.WebhookRequest' produces: - application/json responses: @@ -2371,11 +2611,84 @@ paths: description: Bad Request schema: $ref: '#/definitions/domain.ErrorResponse' - "502": - description: Bad Gateway + "500": + description: Internal Server Error schema: $ref: '#/definitions/domain.ErrorResponse' - summary: Initiate B2C Transfer + summary: Handle Arifpay B2C Webhook + tags: + - Arifpay + /api/v1/arifpay/b2c/transfer: + post: + consumes: + - application/json + description: Initiates a B2C transfer using Telebirr, CBE, or MPESA depending + on the "type" query parameter + parameters: + - description: Transfer type (telebirr, cbe, mpesa) + in: query + name: type + required: true + type: string + - description: Transfer request payload + in: body + name: request + required: true + schema: + $ref: '#/definitions/domain.ArifpayB2CRequest' + produces: + - application/json + responses: + "200": + description: 'message: transfer executed successfully' + schema: + additionalProperties: + type: string + type: object + "400": + description: 'error: invalid request or unsupported transfer type' + schema: + additionalProperties: + type: string + type: object + "500": + description: 'error: internal server error' + schema: + additionalProperties: + type: string + type: object + summary: Execute B2C Transfer + tags: + - Arifpay + /api/v1/arifpay/c2b-webhook: + post: + consumes: + - application/json + description: Handles webhook notifications from Arifpay for C2B transfers and + updates transfer + wallet status. + parameters: + - description: Arifpay webhook payload + in: body + name: request + required: true + schema: + $ref: '#/definitions/domain.WebhookRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Handle Arifpay C2B Webhook tags: - Arifpay /api/v1/arifpay/checkout: @@ -2390,7 +2703,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/domain.CreateCheckoutSessionRequest' + $ref: '#/definitions/domain.CheckoutSessionClientRequest' produces: - application/json responses: @@ -2409,6 +2722,50 @@ paths: summary: Create Arifpay Checkout Session tags: - Arifpay + /api/v1/arifpay/checkout/{sessionId}/cancel: + post: + consumes: + - application/json + description: Cancels a payment session using Arifpay before completion. + parameters: + - description: Checkout session ID + in: path + name: sessionId + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Cancel Arifpay Checkout Session + tags: + - Arifpay + /api/v1/arifpay/payment-methods: + get: + description: Returns all payment method IDs and names for Arifpay + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/domain.ARIFPAYPaymentMethod' + type: array + summary: List Arifpay Payment Methods + tags: + - Arifpay /api/v1/arifpay/session-id/verify-transaction/{session_id}: get: consumes: @@ -2468,7 +2825,41 @@ paths: summary: Verify Arifpay Transaction tags: - Arifpay - /api/v1/auth/login: + /api/v1/auth/admin-login: + post: + consumes: + - application/json + description: Login customer + parameters: + - description: Login admin + in: body + name: login + required: true + schema: + $ref: '#/definitions/handlers.loginAdminReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.loginAdminRes' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Login customer + tags: + - auth + /api/v1/auth/customer-login: post: consumes: - application/json @@ -3029,6 +3420,31 @@ paths: summary: Gets branch for cahier tags: - branch + /api/v1/branchLocation: + get: + consumes: + - application/json + description: Gets all branch locations + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/domain.BranchLocation' + type: array + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Gets all branch locations + tags: + - branch /api/v1/branchWallet: get: consumes: @@ -3743,6 +4159,87 @@ paths: summary: Get all customer wallets tags: - wallet + /api/v1/direct_deposit: + post: + consumes: + - application/json + description: Customer initiates a direct deposit from mobile banking + parameters: + - description: Deposit details + in: body + name: request + required: true + schema: + $ref: '#/definitions/domain.DirectDepositRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Initiate a direct deposit + tags: + - Direct Deposits + /api/v1/direct_deposit/pending: + get: + description: Get list of direct deposits needing verification + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Get pending direct deposits + tags: + - Direct Deposits + /api/v1/direct_deposit/verify: + post: + consumes: + - application/json + description: Cashier verifies a direct deposit transaction + parameters: + - description: Verification details + in: body + name: request + required: true + schema: + $ref: '#/definitions/domain.VerifyDirectDepositRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Verify a direct deposit + tags: + - Direct Deposits /api/v1/events: get: consumes: @@ -3854,7 +4351,7 @@ paths: put: consumes: - application/json - description: Update the event flagged + description: Update the event featured parameters: - description: Event ID in: path @@ -3876,7 +4373,7 @@ paths: description: Internal Server Error schema: $ref: '#/definitions/response.APIResponse' - summary: update the event flagged + summary: update the event featured tags: - event /api/v1/issues: @@ -4703,6 +5200,36 @@ paths: summary: Get results for an event tags: - result + /api/v1/santimpay/payment: + post: + consumes: + - application/json + description: Generates a payment URL using SantimPay and returns it to the client. + parameters: + - description: SantimPay payment request payload + in: body + name: request + required: true + schema: + $ref: '#/definitions/domain.GeneratePaymentURLInput' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Create SantimPay Payment Session + tags: + - SantimPay /api/v1/search/branch: get: consumes: @@ -4760,6 +5287,30 @@ paths: tags: - company /api/v1/shop/bet: + get: + consumes: + - application/json + description: Gets all the shop bets + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/domain.ShopBetRes' + type: array + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Gets all shop bets + tags: + - bet post: consumes: - application/json @@ -5231,6 +5782,35 @@ paths: summary: Create a bet with fast code tags: - bet + /api/v1/sport/bet/fastcode/{fast_code}: + get: + consumes: + - application/json + description: Gets a single bet by fast_code + parameters: + - description: Bet ID + in: path + name: fast_code + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.BetRes' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Gets bet by fast_code + tags: + - bet /api/v1/sport/random/bet: post: consumes: @@ -5315,6 +5895,66 @@ paths: summary: Create a supported operation tags: - branch + /api/v1/telebirr/callback: + post: + consumes: + - application/json + description: Processes the Telebirr payment result and updates wallet balance. + parameters: + - description: Callback payload from Telebirr + in: body + name: payload + required: true + schema: + $ref: '#/definitions/domain.TelebirrPaymentCallbackPayload' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Handle Telebirr Payment Callback + tags: + - Telebirr + /api/v1/telebirr/payment: + post: + consumes: + - application/json + description: Generates a payment URL using Telebirr and returns it to the client. + parameters: + - description: Telebirr payment request payload + in: body + name: request + required: true + schema: + $ref: '#/definitions/domain.GeneratePaymentURLInput' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/domain.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/domain.ErrorResponse' + summary: Create Telebirr Payment Session + tags: + - Telebirr /api/v1/ticket: get: consumes: @@ -5509,6 +6149,31 @@ paths: summary: Get transfer by wallet tags: - transfer + /api/v1/user/admin-profile: + get: + consumes: + - application/json + description: Get user profile + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.AdminProfileRes' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - Bearer: [] + summary: Get user profile + tags: + - user /api/v1/user/bets: get: consumes: @@ -5564,6 +6229,31 @@ paths: summary: Check if phone number or email exist tags: - user + /api/v1/user/customer-profile: + get: + consumes: + - application/json + description: Get user profile + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.CustomerProfileRes' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - Bearer: [] + summary: Get user profile + tags: + - user /api/v1/user/delete/{id}: delete: consumes: @@ -5593,31 +6283,6 @@ paths: summary: Delete user by ID tags: - user - /api/v1/user/profile: - get: - consumes: - - application/json - description: Get user profile - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/handlers.UserProfileRes' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.APIResponse' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.APIResponse' - security: - - Bearer: [] - summary: Get user profile - tags: - - user /api/v1/user/register: post: consumes: diff --git a/internal/domain/shop_bet.go b/internal/domain/shop_bet.go index 30a6b4e..72f280b 100644 --- a/internal/domain/shop_bet.go +++ b/internal/domain/shop_bet.go @@ -85,7 +85,7 @@ type ShopBetRes struct { BetID int64 `json:"bet_id" example:"1"` NumberOfOutcomes int64 `json:"number_of_outcomes" example:"1"` Status OutcomeStatus `json:"status" example:"1"` - Amount Currency `json:"amount" example:"100.0"` + Amount Currency `json:"amount"` Outcomes []BetOutcome `json:"outcomes"` TransactionVerified bool `json:"transaction_verified" example:"true"` UpdatedAt time.Time `json:"updated_at" example:"2025-04-08T12:00:00Z"`