openapi: 3.0.3
info:
  title: api-fraud
  version: 0.0.2
  description: API documentation for the fraud service
servers:
- url: http://fraud-frozone
paths:
  /decision:
    post:
      description: Consumes the decision about a transaction (usually meant for manual
        review) and triggers OMS to process/cancel the order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ComHbcApiFraudV0ModelsDecision'
        required: true
      responses:
        '200':
          description: Successful response
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ComHbcApiFraudV0ModelsError'
  /transaction:
    post:
      description: Provides decision about a transaction by supplying order or other
        information
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ComHbcApiFraudV0ModelsTransaction'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComHbcApiFraudV0ModelsDecision'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ComHbcApiFraudV0ModelsError'
components:
  schemas:
    ComHbcApiFraudV0ModelsError:
      description: Error response model
      type: object
      required:
      - message
      - error
      properties:
        message:
          description: Error description message
          example: Oops, something went wrong!
          type: string
        error:
          description: Error code
          example: invalid_email
          type: string
    ComHbcApiFraudV0ModelsItem:
      description: Single item
      type: object
      required:
      - svsNumber
      - skuNumber
      - currentStatus
      - department
      - description
      - price
      - extendedPrice
      - quantity
      - groupNumber
      - shippingAddress
      - shippingMethod
      - shippingCountry
      properties:
        svsNumber:
          description: Product style number (parent number)
          type: integer
          format: int32
        skuNumber:
          description: HBC internally generated number for items (alias SKN)
          type: integer
          format: int32
        upcNumber:
          description: The number on the barcode that could be used across different
            retailers
          type: integer
          format: int32
        classNumber:
          description: Signifies business category of an item (pants, tops, shirts,
            etc.)
          type: integer
          format: int32
        color:
          type: string
        size:
          type: string
        currentStatus:
          type: string
        department:
          type: integer
          format: int32
        signOnDelivery:
          type: string
        giftWrapped:
          type: boolean
        costAmount:
          type: number
        marginAmount:
          type: number
        description:
          type: string
        price:
          description: Price of single item
          type: number
        extendedPrice:
          description: Total price of all items ordered
          type: number
        quantity:
          type: integer
          format: int32
        groupNumber:
          type: integer
          format: int32
        shippingAddress:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsAddress'
        shippingMethod:
          type: string
        shippingCountry:
          type: string
    ComHbcApiFraudV0ModelsCreditCard:
      description: A customer's complete credit card information
      type: object
      required:
      - nameOnCard
      - billingAddress
      - cardType
      - cardNumber
      - authorizedAmount
      - fullAmount
      - expiryDate
      - authCode
      - responseCode
      - transactionNumber
      - avsResponse
      properties:
        nameOnCard:
          type: string
        billingAddress:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsAddress'
        cardType:
          type: string
        cardNumber:
          type: string
        authorizedAmount:
          type: number
        fullAmount:
          type: number
        expiryDate:
          description: MM-YY that the credit card expires
          type: string
        authCode:
          description: CVV code on the back of the card
          type: string
        responseCode:
          type: integer
          format: int32
        merchantId:
          type: integer
          format: int32
        registerNumber:
          type: string
        transactionNumber:
          type: string
        avsResponse:
          description: 'Address Verification System response, Codes are available
            here: https://www.chasepaymentech.com/address_verification_service.html'
          type: string
    ComHbcApiFraudV0ModelsCustomer:
      description: Customer model
      type: object
      required:
      - customerType
      - accountId
      - creationDate
      - firstName
      - lastName
      - emailAddress
      properties:
        customerType:
          $ref: '#/components/schemas/ComHbcApiFraudV0EnumsCustomerType'
        accountId:
          type: string
        creationDate:
          type: string
          format: date
        firstName:
          type: string
        lastName:
          type: string
        emailAddress:
          type: string
    ComHbcApiFraudV0ModelsDBRecord:
      description: Response model to OMS containing the transaction they've sent and
        the decision we've made
      type: object
      required:
      - transactionId
      - transaction
      - decision
      properties:
        transactionId:
          type: string
        lastModifiedDate:
          type: string
          format: date
        createdDate:
          description: Date this record was first created within the database
          type: string
          format: date
        transaction:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsTransaction'
        decision:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsDecision'
    ComHbcApiFraudV0ModelsPromo:
      description: Promotion model
      type: object
      required:
      - promotionCode
      - promotionAmount
      properties:
        promotionCode:
          type: string
        promotionAmount:
          description: Dollar amount discounted by the promotion
          type: number
    ComHbcApiFraudV0ModelsAddress:
      description: General address model
      type: object
      required:
      - name
      - streetLineOne
      - city
      - state
      - zip
      - country
      properties:
        name:
          type: string
        streetLineOne:
          type: string
        streetLineTwo:
          type: string
        city:
          type: string
        state:
          type: string
        zip:
          type: string
        country:
          type: string
    ComHbcApiFraudV0ModelsDecision:
      description: Defines decision information
      type: object
      required:
      - transactionId
      - recommendationCode
      - totalScore
      properties:
        transactionId:
          type: string
        recommendationCode:
          $ref: '#/components/schemas/ComHbcApiFraudV0EnumsRecommendationCode'
        crossReference:
          type: string
          format: uuid
        rulesTripped:
          type: string
        totalScore:
          type: integer
          format: int32
        remarks:
          type: string
    ComHbcApiFraudV0ModelsAdditionalData:
      description: Envelope data
      type: object
      required:
      - inAuthId
      properties:
        inAuthId:
          type: string
          format: uuid
    ComHbcApiFraudV0ModelsTransaction:
      description: Defines data expected to come in from OMS describing a transaction
      type: object
      required:
      - orderId
      - groupId
      - orderTotal
      - shippingCost
      - currencyCode
      - storeNumber
      - banner
      - creditCard
      - items
      - source
      - customer
      properties:
        orderId:
          type: string
        groupId:
          type: string
        orderTotal:
          type: number
        shippingCost:
          type: number
        currencyCode:
          type: string
        storeNumber:
          type: integer
          format: int32
        salesRep:
          type: string
        lastModifiedDate:
          type: string
          format: date
        banner:
          $ref: '#/components/schemas/ComHbcApiFraudV0EnumsBanner'
        creditCard:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsCreditCard'
        promos:
          type: array
          items:
            $ref: '#/components/schemas/ComHbcApiFraudV0ModelsPromo'
        items:
          type: array
          items:
            $ref: '#/components/schemas/ComHbcApiFraudV0ModelsItem'
        ipAddress:
          type: string
        source:
          description: Order source (web, store, etc)
          type: string
        customer:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsCustomer'
        additionalData:
          $ref: '#/components/schemas/ComHbcApiFraudV0ModelsAdditionalData'
          description: Additional `envelope` data sent through our system to f-s,
            should include InAuthId
    ComHbcApiFraudV0EnumsBanner:
      description: Our lovely store chains
      type: string
      enum:
      - lat
      - s5a
      - o5a
      - bay
    ComHbcApiFraudV0EnumsRecommendationCode:
      description: Enum describing the possible responses
      type: string
      enum:
      - reject
      - review
      - accept
    ComHbcApiFraudV0EnumsCustomerType:
      description: Possible types of customers
      type: string
      enum:
      - guest
      - registered
      - employee
