---
# System prepended metadata

title: Untitled

---

```yaml=
swagger: "2.0"
info:
  description: "This is a sample server Petstore server.  You can find out more about     Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).      For this sample, you can use the api key `special-key` to test the authorization     filters."
  version: "1.0.0"
  title: "Swagger Petstore"
host: "127.0.0.1"
basePath: "/"
tags:
- name: "product"
  description: "商品"
- name: "pointExchangeRule"
  description: "點數交換規則"
schemes:
- "https"
- "http"
paths:
  /api/memberPoint/exchangeRule:
    get:
      tags:
      - "pointExchangeRule"
      summary: "取得點數交換規則"
      consumes:
      - "application/json"
      parameters:
      - name: "name"
        in: "query"
        required: false
        type: "string"
      - name: "origin_member_point_type_id"
        in: "query"
        required: false
        type: "integer"
      - name: "result_member_point_type_id"
        in: "query"
        required: false
        type: "integer"
      - name: "upper_valid_start_at"
        in: "query"
        required: false
        type: "string"
      - name: "lower_valid_start_at"
        in: "query"
        required: false
        type: "string"
      - name: "upper_valid_end_at"
        in: "query"
        required: false
        type: "string"
      - name: "lower_valid_end_at"
        in: "query"
        required: false
        type: "string"
      - name: "valid_days_type"
        in: "query"
        required: false
        type: "string"
        enum:
        - "none"
        - "week"
        - "month"
      - name: "reviewed"
        in: "query"
        required: false
        type: "boolean"
      - name: "enabled"
        in: "query"
        required: false
        type: "boolean"
      - name: "sort_by"
        in: "query"
        required: true
        type: "string"
        enum:
        - "id"
        - "created_at"
        - "valid_start_at"
        - "valid_end_at"
      - name: "order"
        in: "query"
        required: true
        type: "string"
        enum:
        - "asc"
        - "desc"
      - name: "page"
        in: "query"
        required: true
        type: "integer"
      - name: "number_per_page"
        in: "query"
        required: true
        type: "integer"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/PointExchangeRule"
              message:
                type: "string"
              status_code:
                type: "string"
              current_page:
                type: "integer"
              number_per_page:
                type: "integer"
              total:
                type: "integer"
    post:
      tags:
      - "pointExchangeRule"
      summary: "新增點數交換規則"
      consumes:
      - "application/json"
      parameters:
      - name: "body"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/CreatePointExchangeRuleRequest"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/PointExchangeRule"
              message:
                type: "string"
              status_code:
                type: "string"
  /api/memberPoint/exchangeRule/{id}:
    patch:
      tags:
      - "pointExchangeRule"
      summary: "更新點數交換規則"
      consumes:
      - "application/json"
      parameters:
      - name: "id"
        in: "path"
        required: true
        type: "integer"
      - name: "body"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/UpdatePointExchangeRuleRequest"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/PointExchangeRule"
              message:
                type: "string"
              status_code:
                type: "string"
    delete:
      tags:
      - "pointExchangeRule"
      summary: "作廢商品核銷碼"
      consumes:
      - "application/json"
      parameters:
      - name: "id"
        in: "path"
        required: true
        type: "integer"
      responses:
        "200":
          description: "ok"
          schema:
            $ref: "#/definitions/ApiResponse"
  /api/product/batch:
    get:
      tags:
      - "product"
      summary: "取得商品核銷碼管理"
      consumes:
      - "application/json"
      parameters:
      - name: "source"
        in: "query"
        required: false
        type: "string"
        enum:
        - "products"
        - "product_categories"
      - name: "source_id"
        in: "query"
        required: false
        type: "integer"
      - name: "batch_prefix"
        in: "query"
        required: false
        type: "string"
      - name: "upper_created_at"
        in: "query"
        required: false
        type: "string"
      - name: "lower_created_at"
        in: "query"
        required: false
        type: "string"
      - name: "valid_upper_start_at"
        in: "query"
        required: false
        type: "string"
      - name: "valid_lower_start_at"
        in: "query"
        required: false
        type: "string"
      - name: "valid_upper_end_at"
        in: "query"
        required: false
        type: "string"
      - name: "valid_lower_end_at"
        in: "query"
        required: false
        type: "string"
      - name: "reviewed"
        in: "query"
        required: false
        type: "boolean"
      - name: "enabled"
        in: "query"
        required: false
        type: "boolean"
      - name: "invalid"
        in: "query"
        required: false
        type: "boolean"
      - name: "sort_by"
        in: "query"
        required: true
        type: "string"
        enum:
        - "id"
        - "created_at"
        - "valid_start_at"
        - "valid_end_at"
      - name: "order"
        in: "query"
        required: true
        type: "string"
        enum:
        - "asc"
        - "desc"
      - name: "page"
        in: "query"
        required: true
        type: "integer"
      - name: "number_per_page"
        in: "query"
        required: true
        type: "integer"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/ProductBatch"
              message:
                type: "string"
              status_code:
                type: "string"
              current_page:
                type: "integer"
              number_per_page:
                type: "integer"
              total:
                type: "integer"
    post:
      tags:
      - "product"
      summary: "新增商品核銷碼管理"
      consumes:
      - "application/json"
      parameters:
      - name: "body"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/CreateProductBatchRequest"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/ProductBatch"
              message:
                type: "string"
              status_code:
                type: "string"
    delete:
      tags:
      - "product"
      summary: "作廢商品核銷碼管理"
      consumes:
      - "application/json"
      parameters:
      - name: "body"
        in: "body"
        required: true
        schema:
          type: "object"
          properties:
            ids:
              type: "array"
              items:
                type: "integer"
      responses:
        "200":
          description: "ok"
          schema:
            $ref: "#/definitions/ApiResponse"
  /api/product/batch/{id}:
    put:
      tags:
      - "product"
      summary: "更新商品核銷碼管理"
      consumes:
      - "application/json"
      parameters:
      - name: "id"
        in: "path"
        required: true
        type: "integer"
      - name: "body"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/UpdateProductBatchRequest"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/ProductBatch"
              message:
                type: "string"
              status_code:
                type: "string"
  /api/product/batch/code:
    get:
      tags:
      - "product"
      summary: "取得商品核銷碼"
      consumes:
      - "application/json"
      parameters:
      - name: "product_batch_id"
        in: "query"
        required: false
        type: "integer"
      - name: "status"
        in: "query"
        required: false
        type: "string"
        enum:
        - "init"
        - "redeemed"
        - "invalid"
      - name: "identity_type"
        in: "query"
        required: false
        type: "string"
        enum:
        - "member_no"
        - "member_card_no"
        - "mobile"
      - name: "identity"
        in: "query"
        required: false
        type: "string"
        description: "required with identity_type"
      - name: "mapping_code"
        in: "query"
        required: false
        type: "string"
      - name: "sort_by"
        in: "query"
        required: true
        type: "string"
        enum:
        - "id"
        - "updated_at"
      - name: "order"
        in: "query"
        required: true
        type: "string"
        enum:
        - "asc"
        - "desc"
      - name: "page"
        in: "query"
        required: true
        type: "integer"
      - name: "number_per_page"
        in: "query"
        required: true
        type: "integer"
      - name: "export"
        in: "query"
        required: false
        type: "boolean"
      - name: "customized_file_name"
        in: "query"
        required: false
        type: "string"
      responses:
        "200":
          description: "ok"
          schema:
            type: "object"
            properties:
              data:
                type: "array"
                items:
                  $ref: "#/definitions/ProductBatchCode"
              message:
                type: "string"
              status_code:
                type: "string"
              current_page:
                type: "integer"
              number_per_page:
                type: "integer"
              total:
                type: "integer"
    delete:
      tags:
      - "product"
      summary: "作廢商品核銷碼"
      consumes:
      - "application/json"
      parameters:
      - name: "body"
        in: "body"
        required: true
        schema:
          type: "object"
          properties:
            ids:
              type: "array"
              items:
                type: "integer"
      responses:
        "200":
          description: "ok"
          schema:
            $ref: "#/definitions/ApiResponse"
definitions:
  ProductBatch:
    type: "object"
    properties:
      id:
        type: "integer"
      source:
        type: "string"
        enum:
        - "product"
        - "product_categories"
      source_id:
        type: "integer"
      batch_prefix:
        type: "string"
      price:
        type: "integer"
      valid_start_at:
        type: "string"
      valid_end_at:
        type: "string"
      reviewed:
        type: "boolean"
      enabled:
        type: "boolean"
      invalid:
        type: "boolean"
      created_by:
        type: "integer"
      updated_by:
        type: "integer"
      created_at:
        type: "string"
      updated_at:
        type: "string"
      generator:
        type: "object"
        properties:
          id:
            type: "integer"
          number:
            type: "integer"
          status:
            type: "string"
  CreateProductBatchRequest:
    type: "object"
    properties:
      source:
        type: "string"
        enum:
        - "product"
        - "product_categories"
      source_id:
        type: "integer"
      price:
        type: "integer"
      valid_start_at:
        type: "string"
      valid_end_at:
        type: "string"
      generator:
        type: "object"
        properties:
          id:
            type: "integer"
          number:
            type: "integer"
  UpdateProductBatchRequest:
    type: "object"
    properties:
      price:
        type: "integer"
      valid_start_at:
        type: "string"
      valid_end_at:
        type: "string"
      reviewed:
        type: "boolean"
      enabled:
        type: "boolean"
      generator:
        type: "object"
        properties:
          id:
            type: "integer"
          number:
            type: "integer"
  ProductBatchCode:
    type: "object"
    properties:
      id:
        type: "integer"
      product_batch_id:
        type: "integer"
      member:
        type: "object"
        properties:
          no:
            type: "string"
      status:
        type: "string"
        enum:
        - "init"
        - "redeemed"
        - "invalid"
      mapping_code:
        type: "string"
      created_at:
        type: "string"
      updated_at:
        type: "string"
  PointExchangeRule:
    type: "object"
    properties:
      id:
        type: "integer"
      origin_member_point_type_id:
        type: "integer"
      result_member_point_type_id:
        type: "integer"
      name:
        type: "string"
      origin_number:
        type: "integer"
      result_number:
        type: "integer"
      point_expiration_type:
        type: "string"
        enum:
        - "days"
        - "datetime"
        - "years"
      point_expiration_unit:
        type: "integer"
      valid_days_type:
        type: "string"
        enum:
        - "none"
        - "week"
        - "month"
      valid_start_at:
        type: "string"
      valid_end_at:
        type: "string"
      reviewed:
        type: "boolean"
      enabled:
        type: "boolean"
      created_by:
        type: "integer"
      updated_by:
        type: "integer"
      created_at:
        type: "string"
      updated_at:
        type: "string"
  CreatePointExchangeRuleRequest:
    type: "object"
    properties:
      origin_member_point_type_id:
        type: "integer"
      result_member_point_type_id:
        type: "integer"
      name:
        type: "string"
      origin_number:
        type: "integer"
      result_number:
        type: "integer"
      point_expiration_type:
        type: "string"
        enum:
        - "days"
        - "datetime"
        - "years"
      point_expiration_unit:
        type: "integer"
      valid_days_type:
        type: "string"
        enum:
        - "none"
        - "week"
        - "month"
      valid_days_units:
        type: "array"
        items:
          type: "integer"
      valid_start_at:
        type: "string"
      valid_end_at:
        type: "string"
      applicable_membership_level_ids:
        type: "array"
        items:
          type: "integer"
  UpdatePointExchangeRuleRequest:
    type: "object"
    properties:
      origin_member_point_type_id:
        type: "integer"
      result_member_point_type_id:
        type: "integer"
      name:
        type: "string"
      origin_number:
        type: "integer"
      result_number:
        type: "integer"
      point_expiration_type:
        type: "string"
        enum:
        - "days"
        - "datetime"
        - "years"
      point_expiration_unit:
        type: "integer"
      valid_days_type:
        type: "string"
        enum:
        - "none"
        - "week"
        - "month"
      valid_days_units:
        type: "array"
        items:
          type: "integer"
      valid_start_at:
        type: "string"
      valid_end_at:
        type: "string"
      applicable_membership_level_ids:
        type: "array"
        items:
          type: "integer"
      reviewed:
        type: "boolean"
      enabled:
        type: "boolean"
  ApiResponse:
    type: "object"
    properties:
      data:
        type: "array"
        items:
          type: "object"
      message:
        type: "string"
      status_code:
        type: "string"
securityDefinitions:
  apiKey:
    type: apiKey
    in: header
    name: Authorization
```