rulanugrh / thebe

Implementation Midtrans with Gorilla Mux and Postgres SQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage

running this command to run service

docker-compose up -d db

and then running this command to check database can connection

docker logs -f db

last running this command to running app

docker-compose up -d app

List Service

Feature Status
Authentication ✔️
Event ✔️
Payment ✔️
User ✔️
Dockerize ✔️
Frontend Ongoing
Order ✔️
Monitoring Ongoing
File Handler ✔️
Webhook ✔️

API Documentation

Create User - All User

  • Method : POST
  • Endpoint : /user/register/
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
{
    "name": "string",
    "email": "string",
    "password": "string",
    "address": "long",
    "telephone": "string"
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "email": "string",
        "password": "string",
        "address": "long",
        "telephone": "string",
        "role": "string"
    }
}

Login User - All User

  • Method : POST
  • Endpoint : /user/login/
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
{
    "email": "string",
    "password": "string",
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "email": "string",
        "token": "string"
    }
}

Refresh Token - All User

  • Method : POST
  • Endpoint : /user/refresh-token/
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
  • Header :
    • Content-Type : header
  • Body :
Set-Cookie: "token"
  • Response :
{
    "code": "number",
    "message": "string"
}

Validate Token - All User

  • Method : POST
  • Endpoint : /user/validate-token
  • Header :
    • Content-Type : header
  • Body :
{
    "token": "string",
}
  • Response :
{
    "code": "number",
    "message": "string"
}

NotificationSteream Midtrans

  • Method : POST
  • Endpoint : /midtrans/payment-callback/
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Response :
response dari midtrans, sebagai callback untuk ke midtrans

Authentication

Semua api wajib di tambahkan authentikasi dari hasil login user

  • Header :
    • Authorization: Token JWT

FindByID Event - All User

  • Method : GET
  • Endpoint : /api/event/{id}
  • Header :
    • Accept: application/json
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "desc": "string",
        "price": "int",
        "participant": "array"
    }
}

User Logout - All User

  • Method : DELETE
  • Endpoint : /user/logout/
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
  • Header :
    • Content-Type : header
  • Body :
Set-Cookie: "token"
  • Response :
{
    "code": "number",
    "message": "string"
}

Create Order - All User

  • Method : POST
  • Endpoint : /api/order/
  • Header :
    • Accept : application/json
    • Content-Type : application/json
  • Body :
{
    "user_id": "int",
    "event_id": "int"
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "uuid": "string",
        "name": "string",
        "email": "string",
        "address": "string",
        "telephone": "string",
        "event_name": "string",
        "event_price": "int"
    }
}

FindByUUID Order - All User

  • Method : GET

  • Endpoint : /api/order/{uuid}

  • Header :

    • Accept : application/json
    • Content-Type : application/json
  • Response :

{
    "code": "number",
    "message": "string",
    "data": {
        "uuid": "string",
        "name": "string",
        "email": "string",
        "address": "string",
        "telephone": "string",
        "event_name": "string",
        "event_price": "int"
    }
}

FindByUserID Order - All User ( all history user )

  • Method : GET

  • Endpoint : /api/order/{user_id}

  • Header :

    • Accept : application/json
    • Content-Type : application/json
  • Response :

{
    "code": "number",
    "message": "string",
    "data": {
        "uuid": "string",
        "name": "string",
        "email": "string",
        "address": "string",
        "telephone": "string",
        "event_name": "string",
        "event_price": "int"
    }
}

FindByUserIDDetail Order - All User ( detail history )

  • Method : GET

  • Endpoint : /api/order/{user_id}/{uuid}

  • Header :

    • Accept : application/json
    • Content-Type : application/json
  • Response :

{
    "code": "number",
    "message": "string",
    "data": {
        "uuid": "string",
        "name": "string",
        "email": "string",
        "address": "string",
        "telephone": "string",
        "event_name": "string",
        "event_price": "int"
    }
}

Checkout Order - All User

  • Method : POST
  • Endpoint : /api/order/checkout/
  • Header :
    • Accept : application/json
    • Content-Type : application/json
{
    "order_id": "int",
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "snap_url": "string",
        "token": "string",
        "name": "string",
        "event": "string",
        "price": "int"
    }
}

Create Submission Task - All User

  • Method : POST
  • Endpoint : /api/event/{id}/submission
  • Header :
    • Accept : application/json
    • Content-Type : application/json
{
    "name": "string",
    "user_id": "int",
    "event_id": "int",
    "file": "string"
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "event": "string",
        "filename": "string"
    }
}

Handling Status Midtrans - Admin

  • Method : GET
  • Endpoint : /api/order/{uuid}/status
  • Header :
    • Accept : application/json
    • Content-Type : application/json
  • Response :
response by midtrans

Create Event - Admin

  • Method : POST
  • Endpoint : /api/event/
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
{
    "name": "string",
    "desc": "string",
    "price": "int"
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "desc": "string",
        "price": "int",
        "participant": "array"
    }
}

Update Event - Admin

  • Method : PUT
  • Endpoint : /api/event/{id}
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
{
    "name": "string",
    "desc": "string",
    "price": "int"
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "desc": "string",
        "price": "int",
        "participant": "array"
    }
}

FindByID Role - Admin

  • Method : GET

  • Endpoint : /api/role/{id}

  • Header :

    • Content-Type : application/json
  • Response :

{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "description": "text",
        "user": "array",
    }
}

Update Role - Admin

  • Method : PUT
  • Endpoint : /api/role/{id}
  • Header :
    • Content-Type : application/json
    • Accept: application/json
  • Body :
{
    "name": "string",
    "description": "text"
}
  • Response :
{
    "code": "number",
    "message": "string",
    "data": {
        "name": "string",
        "description": "text",
        "user": "array",
    }
}

About

Implementation Midtrans with Gorilla Mux and Postgres SQL


Languages

Language:Go 99.8%Language:Dockerfile 0.2%