alvingxv / marketplace-kelompok-12-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API Piscokku

Anggota Kelompok:

  • Hafizh Abid Wibowo - 502701011
  • Alvian Ghifari - 5027201035
  • Axellino Anggoro A - 5027201040

Register

Method

POST

Endpoint

api/register

Auth

Tidak menggunakan autentikasi

Parameter

{number, name, password}

Contoh Payload

{
    "number": "12345",
    "name": "user",
    "password": "user"
}

Response

{
    "status": 201,
    "message": "User Created"
}

Login

Method

POST

Endpoint

/api/login

Auth

Tidak menggunakan Autentikasi

Parameter

{number, password}

Contoh Payload

{
    "number": "test",
    "password": "test"
}

Response

{
    "status": 200,
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6......"
}

Search Product

Method

POST

Endpoint

/api/searchproduct

Auth

Tidak menggunakan Autentikasi

Parameter

{search}

Contoh Payload

{
    "search": "Vanilla"
}

Response

{
    "Product": [
        {
            "product_name": "Piscok Vanilla",
            "product_price": 50000,
            "product_qty": 497,
            "product_seller": "PISCOK LUMER"
        },
        {
            "product_name": "Piscok Vanillaasdasdsa",
            "product_price": 10000,
            "product_qty": 47,
            "product_seller": "Mafia gedhang"
        }
    ]
}

Get All User

Method

GET

Endpoint

/admin

Auth

Menggunakan autentikasi Admin

Parameter

Tidak ada parameter

Response

{
    "users": [
        {
            "users_number": "085648175777",
            "users_name": "admin",
            "users_password": "$2b$10$mfkk2dToUjjG.sVK7S8XYuFOKlT1PldI/gintdXLrS2l1klhAbKzC",
            "users_role": "admin",
            "users_datecreated": "2022-05-28T23:08:58.000Z",
            "users_balance": 0
        },
        {
            "users_number": "08312321548",
            "users_name": "PISCOK LUMER",
            "users_password": "$2b$10$xd86Svwly10ovOlGdv5wMu2606ZPwutpcSrP/jXGp1ioziIZg6LH6",
            "users_role": "user",
            "users_datecreated": "2022-06-01T00:45:49.000Z",
            "users_balance": 0
        }
    ]
}

Profile

Method

GET

Endpoint

/user/profile

Auth

Menggunakan autentikasi User

Parameter

Tidak ada parameter

Response

{
    "User": {
        "users_number": "081234567",
        "users_name": "Mafia gedhang",
        "users_password": "$2b$10$tvYbb9tUs1jCFqkWvZwYMOiUNs.03NdTomObEoaMWhbxDJLrhfBhq",
        "users_role": "user",
        "users_datecreated": "2022-06-01T00:44:15.000Z",
        "users_balance": 2000
    }
}

Add Product

Method

POST

Endpoint

/user/addproduct

Auth

Menggunakan autentikasi User

Parameter

{product_name, product_qty, product_price}

Contoh Payload

{
    "product_name": "Piscok demo",
    "product_qty": "50",
    "product_price": "10000"
}

Response

{
    "status": 200,
    "message": "Product Added"
}

Update Product

Method

POST

Endpoint

/user/updateproduct

Auth

Menggunakan autentikasi User

Parameter

{product_name, product_qty, product_price}

Contoh Payload

{
    "product_name": "Piscok demo",
    //dapat diisi salah satu dan dua2nya
    "product_qty": "50", 
    "product_price": "10000"
}

Response

{
    "status": 200,
    "message": "Product Updated"
}

Get All Product

Method

GET

Endpoint

/user/getallproduct

Auth

Menggunakan autentikasi User

Parameter

Tidak ada parameter

Response

{
    "Product": [
        {
            "product_id": 1,
            "product_name": "Piscok Keju",
            "product_price": 10000,
            "product_qty": 92,
            "product_seller": "PISCOK LUMER"
        },
        {
            "product_id": 2,
            "product_name": "Piscok Cappucino",
            "product_price": 10000,
            "product_qty": 97,
            "product_seller": "Boss Gedhang"
        }
    ]
}

Buy

Method

POST

Endpoint

/user/buy

Auth

Menggunakan autentikasi User

Parameter

{product_name, product_qty}

Contoh Payload

{
    "product_name": "Piscok Keju",
    "product_qty": "5"
}

Response

{
    "status": 200,
    "message": "Product Ordered, Waiting for Payment"
}

My Order

Method

GET

Endpoint

/user/myorder

Auth

Menggunakan autentikasi User

Parameter

Tidak ada parameter

Response

{
    "Order": [
        {
            "orders_id": 1,
            "orders_status": "Paid",
            "product_id": 9,
            "orders_qty": 5,
            "orders_price": 35000,
            "buyer_name": "afrida",
            "seller_name": "Mafia gedhang"
        },
        {
            "orders_id": 4,
            "orders_status": "Waiting for Payment",
            "product_id": 1,
            "orders_qty": 10,
            "orders_price": 100000,
            "buyer_name": "afrida",
            "seller_name": "PISCOK LUMER"
        }
    ]
}

Pay

Method

POST

Endpoint

/user/pay

Auth

Menggunakan autentikasi User

Parameter

{orders_id, emoney, username, number, password, email}

Contoh Payload

{
    "orders_id": "2",
    "emoney": "Payfresh",
    //optional, tergantung dari emoney yang digunakan
    "username": "PadPay",
    "number": "082169420720",
    "password": "PeacePay",
    "email": "peace@pay.com"
}

Response

{
    "status": 200,
    "message": "Payment Success"
}

Seller Confirm

Method

POST

Endpoint

/user/sellerconfirm

Auth

Menggunakan autentikasi User

Parameter

{orders_id}

Contoh Payload

{
    "orders_id": "2"
}

Response

{
    "status": 200,
    "message": "Confirmation successful (product sent)"
}

Buyer Confirm

Method

POST

Endpoint

/user/buyerconfirm

Auth

Menggunakan autentikasi User

Parameter

{orders_id}

Contoh Payload

{
    "orders_id": "2"
}

Response

{
    "status": 200,
    "message": "Confirmation successful (product received)"
}

Withdraw Funds

Method

POST

Endpoint

/user/withdraw

Auth

Menggunakan autentikasi User

Parameter

{amount, emoney, tujuan}

Contoh Payload

{
    "amount": "1000",
    "emoney": "PeacePay",
    "tujuan": "123"
}

Response

{
    "status": 200,
    "message": "Withdraw Success"
}

About


Languages

Language:JavaScript 100.0%