티스토리 뷰

728x90

여러 예외 케이스들이 있겠으나, 일단 성공 케이스를 중심으로 기록하였다.


파트너

1. 파트너 등록

더보기

Request

POST http://localhost:8000/api/v1/partners
Content-Type: application/json

{
  "partnerName": "정가지",
  "businessNo": "1234123456",
  "email": "gajy@gmail.com"
}

Response

{
    "result": "SUCCESS",
    "data": {
        "partnerToken": "pnt_PyGlEFPaBdiWDbMBPxGR",
        "partnerName": "정가지",
        "businessNo": "1234123456",
        "email": "gajy@gmail.com",
        "status": "ENABLE"
    },
    "message": null,
    "errorCode": null
}

 

아이템

2. 아이템 등록

더보기

Request

POST http://localhost:8000/api/v1/items
Content-Type: application/json

{
  "partnerToken": "pnt_PoHkBfNBJdydYiq7wobN",
  "itemName": "원피스",
  "itemPrice": 50000,
  "itemOptionGroupList": [
    {
      "ordering": "1",
      "itemOptionGroupName": "사이즈",
      "itemOptionList": [
        {
          "ordering": 1,
          "itemOptionName": "SMALL",
          "itemOptionPrice": 0
        },
        {
          "ordering": 2,
          "itemOptionName": "MEDIUM",
          "itemOptionPrice": 0
        },
        {
          "ordering": 3,
          "itemOptionName": "LARGE",
          "itemOptionPrice": 0
        }
      ]

    },
    {
      "ordering": "2",
      "itemOptionGroupName": "컬러",
      "itemOptionList": [
        {
          "ordering": 1,
          "itemOptionName": "RED",
          "itemOptionPrice": 0
        },
        {
          "ordering": 2,
          "itemOptionName": "BLUE",
          "itemOptionPrice": 0
        }
      ]
    }
  ]
}

Response

{
    "result": "SUCCESS",
    "data": {
        "itemToken": "item_yuAzfZSNySTHIZRwRYxe"
    },
    "message": null,
    "errorCode": null
}

3. 아이템 활성화

더보기

Request

POST http://localhost:8000/api/v1/items/change-on-sales
Content-Type: application/json

{
  "itemToken": "item_yuAzfZSNySTHIZRwRYxe"
}

Response

{
    "result": "SUCCESS",
    "data": {
        "itemToken": "item_VxQylTtlXEPvewrUhkpr"
    },
    "message": null,
    "errorCode": null
}

4. 아이템 조회

더보기

Request

GET http://localhost:8000/api/v1/items/item_yuAzfZSNySTHIZRwRYxe
Content-Type: application/json

Response

{
    "result": "SUCCESS",
    "data": {
        "itemToken": "item_yuAzfZSNySTHIZRwRYxe",
        "partnerId": 6,
        "itemName": "원피스",
        "itemPrice": 50000,
        "status": "PREPARE",
        "itemOptionGroupList": [
            {
                "ordering": 1,
                "itemOptionGroupName": "사이즈",
                "itemOptionList": [
                    {
                        "ordering": 1,
                        "itemOptionName": "SMALL",
                        "itemOptionPrice": 0
                    },
                    {
                        "ordering": 2,
                        "itemOptionName": "MEDIUM",
                        "itemOptionPrice": 0
                    },
                    {
                        "ordering": 3,
                        "itemOptionName": "LARGE",
                        "itemOptionPrice": 0
                    }
                ]
            },
            {
                "ordering": 2,
                "itemOptionGroupName": "컬러",
                "itemOptionList": [
                    {
                        "ordering": 1,
                        "itemOptionName": "RED",
                        "itemOptionPrice": 0
                    },
                    {
                        "ordering": 2,
                        "itemOptionName": "BLUE",
                        "itemOptionPrice": 0
                    }
                ]
            }
        ]
    },
    "message": null,
    "errorCode": null
}
주문

5. 주문

더보기

Request

POST http://localhost:8000/api/v1/orders/init
Content-Type: application/json

{
  "userId": "7",
  "payMethod": "CARD",
  "receiverName": "정선주",
  "receiverPhone": "01000001234",
  "receiverZipcode": "12345",
  "receiverAddress1": "서울시 송파구",
  "receiverAddress2": "우리집",
  "etcMessage": "감사합니다",
  "orderItemList": [
    {
      "orderCount": 2,
      "itemToken": "item_yuAzfZSNySTHIZRwRYxe",
      "itemName": "원피스",
      "itemPrice": "50000",
      "orderItemOptionGroupList": [
        {
          "ordering": 1,
          "itemOptionGroupName": "사이즈",
          "orderItemOptionList": [
            {
              "ordering": 1,
              "itemOptionName": "MEDIUM",
              "itemOptionPrice": 0
            }
          ]
        },
        {
          "ordering": 2,
          "itemOptionGroupName": "컬러",
          "orderItemOptionList": [
            {
              "ordering": 1,
              "itemOptionName": "RED",
              "itemOptionPrice": 0
            }
          ]
        }
      ]
    },
    {
      "orderCount": 1,
      "itemToken": "item_VxQylTtlXEPvewrUhkpr",
      "itemName": "목걸이",
      "itemPrice": "70000",
      "orderItemOptionGroupList": [
        {
          "ordering": 1,
          "itemOptionGroupName": "종류",
          "orderItemOptionList": [
            {
              "ordering": 1,
              "itemOptionName": "GOLD",
              "itemOptionPrice": 10000
            }
          ]
        }
      ]
    }
  ]
}

Response

{
    "result": "SUCCESS",
    "data": {
        "orderToken": "ord_TIYDORKJyKEefNBnFoGf"
    },
    "message": null,
    "errorCode": null
}

6. 결제

더보기

Request

POST http://localhost:8000/api/v1/orders/payment-order
Content-Type: application/json

{
  "orderToken": "ord_TIYDORKJyKEefNBnFoGf",
  "payMethod": "CARD",
  "amount": "180000",
  "orderDescription": "주문테스트"
}

Response

{
    "result": "SUCCESS",
    "data": "OK",
    "message": null,
    "errorCode": null
}

7. 주문 조회

더보기

Request

GET http://localhost:8000/api/v1/orders/ord_TIYDORKJyKEefNBnFoGf

Response

{
    "result": "SUCCESS",
    "data": {
        "orderToken": "ord_TIYDORKJyKEefNBnFoGf",
        "userId": 7,
        "payMethod": "CARD",
        "totalAmount": 180000,
        "deliveryInfo": {
            "receiverName": "정선주",
            "receiverPhone": "01000001234",
            "receiverZipcode": "12345",
            "receiverAddress1": "서울시 송파구",
            "receiverAddress2": "우리집",
            "etcMessage": "감사합니다"
        },
        "orderedAt": "2022-10-25 23:46:51",
        "status": "ORDER_COMPLETE",
        "statusDescription": "주문완료",
        "orderItemList": [
            {
                "orderCount": 2,
                "partnerId": 6,
                "itemId": 3,
                "itemName": "원피스",
                "totalAmount": 100000,
                "itemPrice": 50000,
                "deliveryStatus": "BEFORE_DELIVERY",
                "deliveryStatusDescription": "배송전",
                "orderItemOptionGroupList": [
                    {
                        "ordering": 1,
                        "itemOptionGroupName": "사이즈",
                        "orderItemOptionList": [
                            {
                                "ordering": 1,
                                "itemOptionName": "MEDIUM",
                                "itemOptionPrice": 0
                            }
                        ]
                    },
                    {
                        "ordering": 2,
                        "itemOptionGroupName": "컬러",
                        "orderItemOptionList": [
                            {
                                "ordering": 1,
                                "itemOptionName": "RED",
                                "itemOptionPrice": 0
                            }
                        ]
                    }
                ]
            },
            {
                "orderCount": 1,
                "partnerId": 6,
                "itemId": 4,
                "itemName": "목걸이",
                "totalAmount": 80000,
                "itemPrice": 70000,
                "deliveryStatus": "BEFORE_DELIVERY",
                "deliveryStatusDescription": "배송전",
                "orderItemOptionGroupList": [
                    {
                        "ordering": 1,
                        "itemOptionGroupName": "종류",
                        "orderItemOptionList": [
                            {
                                "ordering": 1,
                                "itemOptionName": "GOLD",
                                "itemOptionPrice": 10000
                            }
                        ]
                    }
                ]
            }
        ]
    },
    "message": null,
    "errorCode": null
}
선물하기

8. 선물하기

더보기

Request

POST http://localhost:18080/api/v1/gifts/register
Content-Type: application/json

{
  "buyerUserId": "6",
  "payMethod": "CARD",
  "pushType": "KAKAO",
  "giftReceiverName": "정가지",
  "giftReceiverPhone": "01000001111",
  "giftMessage": "축하한다 가지야~",
  "orderItemList": [
    {
      "orderCount": 2,
      "itemToken": "item_yuAzfZSNySTHIZRwRYxe",
      "itemName": "원피스",
      "itemPrice": "50000",
      "orderItemOptionGroupList": [
        {
          "ordering": 1,
          "itemOptionGroupName": "사이즈",
          "orderItemOptionList": [
            {
              "ordering": 1,
              "itemOptionName": "MEDIUM",
              "itemOptionPrice": 0
            }
          ]
        },
        {
          "ordering": 2,
          "itemOptionGroupName": "컬러",
          "orderItemOptionList": [
            {
              "ordering": 1,
              "itemOptionName": "RED",
              "itemOptionPrice": 0
            }
          ]
        }
      ]
    },
    {
      "orderCount": 1,
      "itemToken": "item_VxQylTtlXEPvewrUhkpr",
      "itemName": "목걸이",
      "itemPrice": "70000",
      "orderItemOptionGroupList": [
        {
          "ordering": 1,
          "itemOptionGroupName": "종류",
          "orderItemOptionList": [
            {
              "ordering": 1,
              "itemOptionName": "GOLD",
              "itemOptionPrice": 10000
            }
          ]
        }
      ]
    }
  ]
}

Response

{
    "result": "SUCCESS",
    "data": {
        "orderToken": "ord_BTnBgipngJkwlOAgMKvz",
        "giftToken": "gt_OzJZCQheAJYVxXQWkriB"
    },
    "message": null,
    "errorCode": null
}

9. 선물하기 상품 결제중으로 변경

더보기

Request

POST http://localhost:18080/api/v1/gifts/gt_OzJZCQheAJYVxXQWkriB/payment-processing
Content-Type: application/json

Response

{
    "result": "SUCCESS",
    "data": "OK",
    "message": null,
    "errorCode": null
}

10. 선물하기 상품 결제 처리

더보기

Request

{
  "orderToken": "ord_BTnBgipngJkwlOAgMKvz",
  "payMethod": "CARD",
  "amount": "180000",
  "orderDescription": "선물하기 주문"
}

Response

{
    "result": "SUCCESS",
    "data": "OK",
    "message": null,
    "errorCode": null
}

Kafka Message

{"orderToken":"ord_BTnBgipngJkwlOAgMKvz"}

결제 결과 데이터 확인 (STATUS = ORDER_COMPLETE)

11. 선물하기 수락

더보기

Request

POST http://localhost:18080/api/v1/gifts/gt_OzJZCQheAJYVxXQWkriB/accept-gift
Content-Type: application/json

{
  "receiverName": "정가지",
  "receiverPhone": "01000001111",
  "receiverZipcode": "123123",
  "receiverAddress1": "서울시 송파구",
  "receiverAddress2": "가지의 집",
  "etcMessage": "감사합니다!"
}

Response

{
    "result": "SUCCESS",
    "data": "OK",
    "message": null,
    "errorCode": null
}

12. 선물하기 조회

더보기

Request

GET http://localhost:18080/api/v1/gifts/gt_OzJZCQheAJYVxXQWkriB
Content-Type: application/json

Response

{
    "result": "SUCCESS",
    "data": {
        "orderToken": "ord_BTnBgipngJkwlOAgMKvz",
        "giftToken": "gt_OzJZCQheAJYVxXQWkriB",
        "pushType": "KAKAO",
        "giftReceiverName": "정가지",
        "giftReceiverPhone": "01000001111",
        "giftMessage": "축하한다 가지야~"
    },
    "message": null,
    "errorCode": null
}

 

https://fastcampus.co.kr/dev_red_lhc

 

The RED : 비즈니스 성공을 위한 Java/Spring 기반 서비스 개발과 MSA 구축 by 이희창 | 패스트캠퍼스

쿠팡, 토스를 거친 29CM의 개발 디렉터 이희창이 주문하기, 선물하기 기능 개발 경험을 토대로 MSA 구축 실무 프로젝트를 위주로 구성한 강의 입니다. 잘 짜여진 코드와 MSA 전환에 필요한 이론 뿐

fastcampus.co.kr

728x90
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30