Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
24 kB
2
Indexable
Never
openapi: 3.0.1

info:
  version: "1.0"
  title: Custom CSI Rest Interface
  description: Simple REST service extending OTL CSI functionality by querying database directly.
  license:
    name: Licensed by Scheidt & Bachmann GmbH
servers:
  - url: 'http://10.66.37.43:4000'
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
tags: 
  - name: Monitoring
  - name: Velocity
  - name: Accounts
  - name: Cards
  - name: Buckets
paths:
  /customCsi/monitoring/getHealth:
    get:
      tags:
        - Monitoring
      summary: Health check
      description: Checks health of the OTL db connection.
      operationId: health
      responses:
        '200':
          description: 'Health check provided'
          content:
            application/json:
              schema:
               $ref: '#/components/schemas/HealthResponse'
  /customCsi/monitoring/getVelocity:
    get:
      tags:
        - Monitoring
      summary: Velocity check
      description: Check Velocity of the OTL db connection.
      operationId: velocity
      responses:
        '200':
          description: 'Velocity check provided'
          content:
            application/json:
              schema:
               $ref: '#/components/schemas/VelocityResponse'
  /customCsi/searchAccounts:
    get:
      tags:
        - Accounts
      summary: Account list
      description: Returns list of accounts by search parameters
      operationId: searchAccounts
      parameters:
      - in: query
        name: accountType
        example: C
        description: Account type (P - personal, C - corporation, U - university)
        schema:
          type: string
        required: false
      - in: query
        name: firstName
        description: Name assigned to the account
        schema:
          type: string
        required: false
      - in: query
        name: lastName
        description: Lastname assigned to the account
        schema:
          type: string
        required: false
      - in: query
        name: phone
        description: Phone number assigned to the account
        schema:
          type: string
        required: false
      - in: query
        name: email
        example: roman
        description: Email address assigned to the account
        schema:
          type: string
        required: false
      - in: query
        name: masterAccountName
        description: Master account name (accountType = master account)
        schema:
          type: string
        required: false
      - in: query
        name: customerId
        description: CustomerId identifier (accountType = master account)
        schema:
          type: string
        required: false
      - in: query
        name: corporationCategory
        description: Corporation category (accountType = master account)
        schema:
          type: string
        required: false
      - in: query
        name: orderBy
        example: accountNumber
        description: By what field should response be ordered
        schema:
          type: string
        required: true
      - in: query
        name: sortBy
        example: desc
        description: Ascending or descending based on orderBy query parameter
        schema:
          type: string
        required: true
      - in: query
        name: offset
        example: 0
        description: Start index
        schema:
          type: number
        required: true
      - in: query
        name: limit
        example: 15
        description: How many accounts should be in the response
        schema:
          type: number
        required: true
      responses:
        '200':
          description: Returns list of accounts for specified query parameters in selected order
          content:
            application/sb.csi.searchAccounts.v1+json:
              schema:
                $ref: '#/components/schemas/SearchAccountsResponse'
        '400':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /customCsi/cardStatus:
    post:
      tags:
        - Cards
      summary: Media status list
      description: Returns current and previous statuses of the card/medium
      operationId: cardStatus
      requestBody:
        content:
          application/sb.csi.card.status.v1+json:
            schema:
              $ref: '#/components/schemas/CardStatusParam'
      responses:
        '200':
          description: Returns current and previous statuses of the card/medium
          content:
            application/sb.csi.card.status.v1+json:
              schema:
                $ref: '#/components/schemas/CardStatusResponse'
        '400':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /customCsi/searchCards:
    get:
      tags:
        - Cards
      summary: Card list
      description: Return lightweight card list for selected parameters
      operationId: searchCards
      parameters:
      - in: query
        name: mediaId
        example: 670995365281871853
        description: MediaId/Token of the card
        schema:
          type: string
        required: false
      - in: query
        name: accountId
        example: 25007
        description: Account number of the master account
        schema:
          type: string
        required: false
      - in: query
        name: accountAlias
        example: iba
        description: Account alias of the account of the selected card (account association)
        schema:
          type: string
        required: false
      - in: query
        name: cardStatus
        example: 0
        description: Status of the card
        schema:
          type: string
        required: false
      - in: query
        name: orderBy
        example: accountId
        description: What field should be used for ordering
        schema:
          type: string
        required: true
      - in: query
        name: sortBy
        example: desc
        description: Ascending or Descending by the orderBy query parameter
        schema:
          type: string
        required: true
      - in: query
        name: offset
        example: 0
        description: Start index
        schema:
          type: number
        required: true
      - in: query
        name: limit
        example: 5
        description: How many results in the response
        schema:
          type: number
        required: true
      responses:
        '200':
          description: Returns list of cards for specified query parameters in selected order
          content:
            application/sb.csi.searchCards.v1+json:
              schema:
                $ref: '#/components/schemas/SearchCardsResponse'
        '400':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /customCsi/corporateCards:
    post:
      tags:
        - Cards
      summary: Card list
      description: Returns card list for selected master account
      operationId: corporateCards
      requestBody:
        content:
          application/sb.csi.corporatecards.v1+json:
            schema:
              $ref: '#/components/schemas/CorporateCardsParam'
      responses:
        '200':
          description: Returns cards list for selected master account
          content:
            application/sb.csi.corporatecards.v1+json:
              schema:
                $ref: '#/components/schemas/CorporateCardsResponse'
        '400':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Response in case of error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /customCsi/buckets:
     get:
      tags: 
        - Buckets
      summary: Obtain current buckets' levels information for an account
      description: Provide details on current bucket levels for given account
      operationId: GetAccountBuckets
      parameters: 
        - name: accountId
          in: query
          required: true
          description: Account Id to be queried
          schema:
            type: integer
            example: 12345
      responses:
        '200': 
          description: OK
          content:
            application/vnd.sb.cappingbuckets-v1+json:
              schema:
                $ref: '#/components/schemas/CapBuckets'
 
components:
  schemas:
    HealthResponse:
      type: object
      properties:
        dbHealthCheck:
          type: string
          description: Status OK/NOK
          example: OK
    VelocityResponse:
      type: object
      properties:
        dbVelocityCheck:
          type: string
          description: Status OK/NOK
          example: OK
    CardStatusParam:
      type: object
      properties:
        mediaId:
          type: string
          description: Token/Media id of the card
          example: 7766529704439010699
        offset:
          type: integer
          format: int64
          description: Offset (Start index)
          example: 0
        limit:
          type: integer
          format: int64
          description: Limit (How many statuses in the response)
          example: 5
    CorporateCardsParam:
      type: object
      properties:
        accountNumber:
          type: number
          description: Master account number
          example: 25007
        alias:
          type: string
          description: Alias of the account assigned to the card for filtering
          example: ''
        cardStatus:
          type: string
          description: Status of the card for filtering
          example: 1
        fieldGroup:
          type: string
          description: This parameter is not used currently (maybe for future use)
          example: all
        mediaId:
          type: string
          description: MediaId/Token of the card for filtering
          example: ''
        offset:
          type: integer
          format: int64
          description: Offset (Start index)
          example: 0
        limit:
          type: integer
          format: int64
          description: Limit (How many cards in the response)
          example: 5
    SearchAccountsResponse:
      type: object
      properties:
        totalNumber:
          type: integer
          format: int64
          description: How many results (accounts) are there for specificed parameters
          example: 2
        hasMore:
          type: boolean
          description: If there are more results (accounts) to be queried
          example: false
        accounts:
          type: array
          description: List of the accounts for selected query parameters in defined order
          items:
            $ref: '#/components/schemas/SearchAccount'
    SearchCardsResponse:
      type: object
      properties:
        totalNumber:
          type: integer
          format: int64
          description: How many results (cards) are there for specificed parameters
          example: 2
        hasMore:
          type: boolean
          description: If there are more results (cards) to be queried
          example: false
        cards:
          type: array
          description: List of the cards for selected query parameters in defined order
          items: 
            $ref: '#/components/schemas/SearchCard'
    SearchAccount:
      type: object
      properties:
        accountNumber:
          type: integer
          format: int64
          description: Account number
          example: 31459
        accountType:
          type: string
          description: Account type ('P', 'C', 'U')
          example: 'C'
        accountStatus:
          type: string
          description: Status of the account
          example: 1
        firstName:
          type: string
          description: First name
          example: roman
        lastName:
          type: string
          description: Last name
          example: roman
        email:
          type: string
          description: Email address of the account
          example: romanx@test.com
        homePhone:
          type: string
          description: Phone (type = homephone)
        officePhone:
          type: string
          description: Phone (type = office)
          example: 9999999999
        mobilePhone:
          type: string
          description: Phone (type = mobile)
        activeCardsCount:
          type: integer
          format: int64
          description: Number of active card assigned to the account
          example: 0
        masterAccountInformation:
          type: object
          properties:
            name:
              type: string
              description: Name of the master account
              example:  romanx
            contactFirstName:
              type: string
              description: First name of the corporation's contact
              example: roman
            contactLastName:
              type: string
              description: Last name of the corporation's contact
              example: roman
            customerId:
              type: string
              description: Customer Id identifier
              example: romanx
            permanentCity:
              type: string
              description: City
              example: Accord
            permanentAddress:
              type: string
              description: Address
              example: Test 123
            permanentPostalCode:
              type: string
              description: Postal code
              example: 12404
            permanentState:
              type: string
              description: State
              example: NY
            permanentCountry:
              type: string
              description: Country
              example: USA
            description:
              type: string
              description: Description of the master account (special for Corporation - discount for products)
              example: REDUCED_TICKETS_NOT_ALLOWED
            corporationCategory:
              type: string
              description: Category of the corporation
              example: CORPORATION
    SearchCard:
      type: object
      properties:
        mediaId:
          type: string
          description: MediaId/Token of the card
          example: '6709953652818718534'
        maskedId:
          type: string
          description: Masked card number
          example: '************3128'
        personalizationType:
          type: string
          description: Personalization type of the card
          example: ANONY
        cardStatus:
          type: string
          description: Status of the card
          example: 0
        idType:
          type: integer
          format: int64
          description: Id type of the card
          example: 1023
        accountNumber:
          type: integer
          format: int64
          description: Account number of the card
          example: 39928
        accountAlias:
          type: string
          description: Account alias of the card from account association table
          example: ibatext
    CorporateCardsResponse:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/CorporateCardsInnerResponse'
    CorporateCardsInnerResponse:
      type: object
      properties:
        totalNumber:
          type: integer
          format: int64
          description: How many results (cards) are there for specificed parameters
          example: 2
        hasMore:
          type: boolean
          description: If there are more results (cards) to be queried
          example: false
        cards:
          type: array
          description: List of the cards for selected parameters (master account, status, ..)
          items:
            $ref: '#/components/schemas/Card'
    Card:
      type: object
      properties:
        mediaId:
          type: string
          description: MediaId/Token of the card
          example: '001783412914752283'
        customerType:
          type: string
          description: OTL value for customerType
          example: ANONY
        cardStatus:
          type: string
          description: Card status
          example: 1
        maskedId:
          type: string
          description: Masked card number
          example: '************4462'
        idType:
          type: string
          description: Id type of the card
          example: 1023
        initializationDate:
          type: string
          format: datetime
          description: Time when card was initialized
          example: 2020-09-21T12:15:13Z
        cardExpiryDate:
          type: string
          format: datetime
          description: Time when card expires
          example: 2030-06-03T04:00:00Z
        issueDate:
          type: string
          format: datetime
          description: Issue date of the card (issue_date)
        warrantyEndDate:
          type: string
          format: datetime
          description: Warranty end date (warranty_end_date)
        refundProgress:
          type: string
          description: Refund progress (card_refund_progress)
        refundProgressDate:
          type: string
          format: datetime
          description: Refund progress date (card_refund_progress_date)
        refundReason:
          type: string
          description: Refund reason (refund_reason)
        graphicType:
          type: string
          description: Longer card type
          example: ANONYMOUS
        depositValue:
          type: integer
          format: int64
          description: Deposit value (deposit_value)
        accountNumber:
          type: integer
          format: int64
          description: Account number of the card
          example: 30286
        lastUpdateTime:
          type: string
          format: datetime
          description: Last time when card was updated
          example: 2020-09-21T12:31:27Z
        lastUpdateBy:
          type: string
          description: Last user that updated the card record
          example: tstuser0
        personalizationType:
          type: string
          description: Personalization type of the card
          example: ANONY
        alias:
          type: string
          description: Alias of the account of the selected card (from account association table)
          example: pondelok1
    CardStatusResponse:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/CardStatusInnerResponse'
    CardStatusInnerResponse:
      type: object
      properties:
        mediaId:
          type: string
          description: Token/Media id of the card
          example: 7766529704439010699
        currentCardStatus:
          type: string
          description: Current status of the card
          example: 4
        totalNumber:
          type: integer
          description: How many results (statuses) are there for card
          example: 2
        hasMore:
          type: boolean
          description: If there are more results (statuses) to be queried
          example: false
        cardStatusList:
          type: array
          description: List of the previous status changes of the card
          items:
            $ref: '#/components/schemas/CardStatusDetail'
    CardStatusDetail:
      type: object
      properties:
        transactionMetadata:
          $ref: '#/components/schemas/TransactionMetadata'
        reasonCode:
          type: integer
          format: int64
          description: Reason code from OTL enum
          example: 255
        remarks: 
          type: string
          description: Additional text provided to OTL during change requst (e.g. Employee left the company)
          example: Employee left Company
    TransactionMetadata:
      type: object
      properties:
        transactionType:
          type: string
          description: OTL Txn type
          example: 2
        transationSubtype:
          type: string
          description: OTL txn sub type
          example: 8
        transactionTimestamp:
          type: string
          description: Timestamp of the transaction
          example: 2022-08-02T10:42:59Z
        transactionReference:
          type: string
          description: Unique identifier of the transaction
          example: 4004-4004001-20220802064259-1659436979433
        tariffVersionId:
          type: string
          description: Tariff version id
          example: 123
        locationId:
          type: string
          description: Location Id
          example: 123
        locationType:
          type: string
          description: Location Type
          example: 123
        tariffLocationId:
          type: string
          description: Tariff location id
          example: 123
        agentId:
          type: string
          description: Agent id
          example: 2222
        shiftId:
          type: string
          description: Shift Id
          example: 999
        deviceId:
          type: string
          description: Device id of the transaction
          example: 4004001  
        deviceClassId:
          type: string
          description: Device class id of the transaction
          example: 4004
        serviceMode:
          type: string
          description: Service mode of the transaction
          example: 10
        businessEntityId:
          type: integer
          description: Identifier of the company in the OTL system
          example: 69123
        geolocation:
          $ref: '#/components/schemas/Geolocation'
        testMode:
          type: boolean
          description: Flag for OTL
          example: false
    Geolocation:
      type: object
      properties:
        longitude:
          type: number
          description: Longitude
          example: 4.2
        latitude:
          type: number
          description: Latitude
          example: 4.2
    CapBucket:
      type: object
      required: 
        - bucketId
        - value
        - capLevel
      properties:
        bucketId:
          type: string
          description: Bucket identification
          example: "100130101"
        value:
          type: integer
          description:  Accumulated value in the bucket, in cents
          example: 3350
        capLevel:
          description: Capping level for the bucket, in cents
          type: integer
          example: 7500
    CapBuckets:
      type: object
      required: 
        - accountId
        - capBuckets
      properties:
        accountId: 
          type: integer
          example: 12345
        capBuckets:
          type: array
          items:
            $ref: '#/components/schemas/CapBucket' 
    ErrorResponse:
      type: object
      properties:
        error: 
          $ref: '#/components/schemas/Error'
    Error:
      type: object
      properties:
        code: 
          type: string
          description: Error code
          example: 1003
        message:
          type: string
          description: Message text for the error
          example: Incorrect content type / accept for request /customCsi/cardStatus