swagger: '2.0'
info:
  title: Thales TSH Transit API - WS to TSH
  description: Thales TSH Transit API - WS to TSH
  termsOfService: Copyright (c) 2019 Thales. All Rights Reserved
  version: 1.0.8
paths:
  /checkCardAccount:
    post:
      summary: Request to check digital card account eligibility
      description: This method is used by wallet server to check that a card account is eligible for provisioning.
      operationId: checkCardAccount
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/checkCardAccountReq'
          description: checkCardAccount request payload
          required: true
      responses:
        '200':
          description: checkCardAccount response payload
          schema:
            $ref: '#/definitions/checkCardAccountRes'
        '500':
          description: Internal Server Error
  /getAsset:
    post:
      summary: Request to fetch an asset
      description: This method is used by Wallet Server to fetch the content of an asset.
      operationId: getAsset
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/getAssetReq'
          description: getAsset request payload
          required: true
      responses:
        '200':
          description: getAsset response payload
          schema:
            $ref: '#/definitions/getAssetRes'
        '500':
          description: Internal Server Error
  /provisionCard:
    post:
      summary: Request to provision a digital card
      description: This method is used by wallet server to provision a digital card to user's device.
      operationId: provisionCard
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/provisionCardReq'
          description: provisionCard request payload
          required: true
      responses:
        '200':
          description: provisionCard response payload
          schema:
            $ref: '#/definitions/provisionCardRes'
        '500':
          description: Internal Server Error
  /manageCard:
    post:
      summary: 'Request to suspend, resume or delete/park a digital card'
      description: 'This method is used by Wallet Server to request a suspend, resume or park/delete a virtual card.'
      operationId: manageCard
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/manageCardReq'
          description: manageCard request payload
          required: true
      responses:
        '200':
          description: manageCard response payload
          schema:
            $ref: '#/definitions/manageCardRes'
        '500':
          description: Internal Server Error
  /sendScriptCallback:
    post:
      summary: Callback to sendScript request
      description: This method is used by Wallet server to provide a callback to a previous sendScript sent by TSH.
      operationId: sendScriptCallback
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/sendScriptCallbackReq'
          description: sendScriptCallback request payload
          required: true
      responses:
        '200':
          description: sendScriptCallback response payload
          schema:
            $ref: '#/definitions/sendScriptCallbackRes'
        '500':
          description: Internal Server Error
  /updateCardCallback:
    post:
      summary: Callback to updateCard request
      description: This method is used by Wallet server to provide a callback to a previous updateCard sent by TSH.
      operationId: updateCardCallback
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/updateCardCallbackReq'
          description: updateCardCallback request payload
          required: true
      responses:
        '200':
          description: updateCardCallback response payload
          schema:
            $ref: '#/definitions/updateCardCallbackRes'
        '500':
          description: Internal Server Error
  /getCardStatus:
    post:
      summary: Request to get the current status of a digital card
      description: This method is used by Wallet Server to the current status of a digital card.
      operationId: getCardStatus
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/getCardStatusReq'
          description: getCardStatus request payload
          required: true
      responses:
        '200':
          description: getCardStatus response payload
          schema:
            $ref: '#/definitions/getCardStatusRes'
        '500':
          description: Internal Server Error
  /getCardAccountStatus:
    post:
      summary: Request to get the current status of a card account
      description: This method is used by Wallet Server to the current status of a card account.
      operationId: getCardAccountStatus
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/getCardAccountStatusReq'
          description: getCardAccountStatus request payload
          required: true
      responses:
        '200':
          description: getCardAccountStatus response payload
          schema:
            $ref: '#/definitions/getCardAccountStatusRes'
        '500':
          description: Internal Server Error
  /getCardCommands:
    post:
      summary: Request to provide the next list of commands to be executed for a specific card
      description: |-
        This method is used to request the pending commands to be executed for a specific card.</br> Device should keep coming back when:  - HTTP 200 is returned with statusCode=0 and APDU commands are provided
          - or HTTP 500 is returned (until max number of retries is reached)
          - or TSH is not accessible (until max number of retries is reached)
      operationId: getCardCommands
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - $ref: '#/parameters/podHeader'
        - in: body
          name: body
          schema:
            $ref: '#/definitions/getCardCommandsReq'
          description: getCardCommands request payload
          required: true
      responses:
        '200':
          description: getCardCommands response payload
          schema:
            $ref: '#/definitions/getCardCommandsRes'
        '500':
          description: Internal Server Error
definitions:
  checkCardAccountReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      issuerId:
        $ref: '#/definitions/issuerId'
      cardAccountDescriptor:
        $ref: '#/definitions/cardAccountDescriptor'
      device:
        $ref: '#/definitions/device'
      cardSource:
        $ref: '#/definitions/cardSource'
    required:
      - requestHeader
      - issuerId
      - cardAccountDescriptor
      - device
  requestHeader:
    type: object
    properties:
      requestId:
        $ref: '#/definitions/requestId'
      sessionId:
        $ref: '#/definitions/sessionId'
      generationDateTime:
        $ref: '#/definitions/generationDateTime'
    required:
      - requestId
      - sessionId
  requestId:
    type: string
    description: Unique request identifier
    minLength: 1
    maxLength: 48
  sessionId:
    type: string
    description: Unique session identifier used to trace the calls across systems during a use case.
    minLength: 1
    maxLength: 48
  generationDateTime:
    type: string
    description: |-
      Date time representing when the request or response has been generated.<br/>RFC3339 format.<br/> Examples:
        - "2018-12-24T17:32:28Z"
        - "2019-10-02T10:00:00-05:00"
    format: date-time
  issuerId:
    type: string
    description: The Card Issuer Identifier. Unique for each card issuer.
    minLength: 1
    maxLength: 16
  cardAccountDescriptor:
    type: object
    description: |-
      The Card Account Descriptor.<br/>Depending on cardSource, it shall be formatted as follows:
      - For ON-FILE:<br/>"cardAccountDescriptor" : {"walletCardAccountId" : "1234"}
      - For USER-INPUT, CLIENT-SDK and READER-MODE:<br/>"cardAccountDescriptor" : {"opaqueCardAccountData" : "data returned by Issuer backend to Wallet"}
  device:
    type: object
    properties:
      seId:
        $ref: '#/definitions/seId'
      deviceType:
        $ref: '#/definitions/deviceType'
      language:
        $ref: '#/definitions/language'
      phoneNumberLastDigits:
        $ref: '#/definitions/phoneNumberLastDigits'
      deviceName:
        $ref: '#/definitions/deviceName'
    required:
      - seId
      - deviceType
      - language
  seId:
    type: string
    description: Secure Element Identifier
    pattern: '([0-9a-fA-F][0-9a-fA-F]){1,24}'
  deviceType:
    type: string
    enum:
      - PHONE
      - TABLET
      - WATCH
      - UNKNOWN
  language:
    type: string
    description: ISO 639-3 three-letter language codes
    minLength: 3
    maxLength: 3
  phoneNumberLastDigits:
    type: string
    description: Last digit of the phone number (usually 4 or 5)
    minLength: 1
    maxLength: 5
  deviceName:
    type: string
    description: Device name that the device owner may use to identify it
    minLength: 1
    maxLength: 128
  cardSource:
    type: string
    enum:
      - ON-FILE
      - CLIENT-SDK
      - USER-INPUT
      - READER-MODE
  checkCardAccountRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|
              |113|Unknown issuer|     
              |115|Unknown product|          
              |116|Unknown card account|                 
              |159|Card is blacklisted|
              |160|Card is deleted|               
              |162|Card has unsufficient balance|
              |163|Card product not eligible|                                                            
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
      termsAndConditionsId:
        type: string
        description: 'Unique identifier of the T&C to be presented to the end user.</br> If T&Cs are not required, all 0''s should be returned.</br> getAsset API will be used to retrieve the T&Cs content.'
        maxLength: 64
      cardArtManifest:
        $ref: '#/definitions/cardArtManifest'
    required:
      - responseHeader
  responseId:
    type: string
    description: Unique response identifier
    minLength: 1
    maxLength: 48
  cardArtManifest:
    type: array
    description: Array of GUIDs required to build card art.</br> Each cart art can be retrieved using getAsset API with corresponding GUID.
    items:
      type: string
      maxLength: 64
  getAssetReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      guid:
        type: string
        maxLength: 64
    required:
      - requestHeader
      - guid
  getAssetRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|
              |123|Unknown asset|
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
      contentType:
        type: string
        enum:
          - icon
          - cardBackgroundCombined
          - termsAndConditions
      content:
        type: object
        properties:
          mimeType:
            type: string
            enum:
              - image/pdf
              - image/png
              - text/plain
              - text/html
            description: File type of encoded image or T&C.</br> "image/pdf" and "image/png" are applicable to card art only.</br> "text/plain" and "text/html" are applicable to T&C only.</br>
          encodedData:
            type: string
            description: Base64 encoded asset data
          width:
            type: string
            description: Cart art width.</br> Required for PNG images.
          height:
            type: string
            description: Cart art height.</br> Required for PNG images
    required:
      - responseHeader
  provisionCardReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      issuerId:
        $ref: '#/definitions/issuerId'
      cardAccountDescriptor:
        $ref: '#/definitions/cardAccountDescriptor'
      ssdDescriptor:
        $ref: '#/definitions/ssdDescriptor'
      walletAccountId:
        $ref: '#/definitions/walletAccountId'
      device:
        $ref: '#/definitions/device'
      walletScoring:
        $ref: '#/definitions/walletScoring'
      customerData:
        $ref: '#/definitions/customerData'
      cardLastDigits:
        $ref: '#/definitions/cardLastDigits'
      cryptoOTP:
        $ref: '#/definitions/cryptoOTP'
    required:
      - requestHeader
      - issuerId
      - cardAccountDescriptor
      - ssdDescriptor
      - walletAccountId
      - device
  ssdDescriptor:
    type: object
    description: Metadata of the SSD hosting the issuer applet.</br> It is used by TSH to compute personalization script.
    properties:
      aid:
        type: string
        description: hexadecimal representation of SSD AID
        pattern: '([a-fA-F0-9][a-fA-F0-9]){5,16}'
      appletInstanceAid:
        type: string
        description: hexadecimal representation of Issuer Applet AID
        pattern: '([a-fA-F0-9][a-fA-F0-9]){5,16}'
      apduResponse:
        type: string
        description: 'hexadecimal representation of TLV:<li>Tag 85 = DR (optional)<li>Tag 86 = Receipt (mandatory)<li>Tag A6 = CRT (mandatory)<br/><br/>as defined in GP Amendment E.<br/><br/><b><u>Example</u></b>:<br/>8510332A524EF397AF72E75333FF5E853D9F86106B58F49CD5339DCA61086710D5992948A61690020303950110960100800188810110820105830130'
        pattern: '([a-fA-F0-9][a-fA-F0-9])+'
        maxLength: 512
      counter:
        type: string
        description: current SSD sequence counter
        pattern: '([a-fA-F0-9][a-fA-F0-9]){3}'
      casdCertificate:
        type: string
        description: 'CASD GP certificate as defined in GP Amendment E.<br/><br/><b><u>Example</u></b>:<br/>7F2181BD7F2181B993100431171BCB53800191700015133013074207637093010000395F200100950200805F2404211804034501007F4946B041047EED4B67E5937FC77DA23FE0AB250A4689B878165602B8AEA3075BF1D8B5021CDA9E17956CC0454614FDE8A218987B4BD19649DD4E50839BA574DEB2F3A56C8DF001005F3740869C9DA25B1E8DCE37893B0188A6587B32BAA6923FF0927836D5614FCA83283B9186FC39135DBBD40D747A37A802D2E86815DADD8A6278319E5BEE9BB3582754'
        pattern: '([a-fA-F0-9][a-fA-F0-9])+'
        maxLength: 512
      spsdCertificateSerialNumber:
        type: string
        description: Serial number of the SPSD certificate used to generate OBGK.</br>This serial number can be used to match against certificate when multiple certificates are supported or when certificate has been replaced because of expiration.
        pattern: '([a-fA-F0-9][a-fA-F0-9]){1,32}'
    required:
      - aid
      - appletInstanceAid
      - apduResponse
      - counter
      - casdCertificate
      - spsdCertificateSerialNumber
  walletAccountId:
    type: string
    description: The Wallet Account Identifier. Unique for each wallet account.
    minLength: 1
    maxLength: 128
  walletScoring:
    type: object
    properties:
      color:
        type: string
        enum:
          - GREEN
          - YELLOW
          - ORANGE
      deviceScore:
        type: number
        description: |
          |Score|Description|
          |-------|-------|
          |5|Long history of activity; No suspicious activity|
          |4|Short history of activity; No suspicious activity|
          |3|Little or No history|
          |2|Irregular activity noted|
          |1|Improper activity noted|
        minimum: 1
        maximum: 5
      accountScore:
        type: number
        description: |
          |Score|Description|
          |-------|-------|
          |5|Long history of activity; No suspicious activity|
          |4|Short history of activity; No suspicious activity|
          |3|Little or No history|
          |2|Irregular activity noted|
          |1|Improper activity noted|
        minimum: 1
        maximum: 5
      phoneNumberScore:
        type: number
        description: |
          |Score|Description|
          |-------|-------|
          |5|Long history of activity; No suspicious activity|
          |4|Short history of activity; No suspicious activity|
          |3|Little or No history|
          |2|Irregular activity noted|
          |1|Improper activity noted|
        minimum: 1
        maximum: 5
      reasonCodes:
        type: array
        description: List of reasons
        maxItems: 100
        items:
          type: string
          description: |
            |reasonCode|Description|
            |-------|-------|
            |01|User Wallet Account ID too new relative to launch|
            |02|User Wallet Account ID too new relative to provisioning request|
            |03|User Wallet Account ID/Card Pair is newer than date threshold|
            |04|Changes made to account data within date threshold|
            |05|Suspicious transactions linked to this account.|
            |06|The Account has not had activity in the last year.|
            |07|Suspended cards in the secure element|
            |08|The device was put in lost mode in the last 7 days for longer than the duration threshold|
            |09|The number of provisioning attempts on this device in 72 hours exceeds the threshold|
            |0A|There have been more than the threshold number of different cards attempted at provisioning to this phone in 24 hours.|
            |0B|The card provisioning request contains a distinct name in excess of the permitted threshold|
            |0C|Device Score is less than 3|
            |0D|Device Score is less than 4|
            |0E|Device provisioning location outside of OEM marketplace store home country|
            |0F|Model rules not available at this time (in cases where back end systems time out).|
            |0G|Orange path flag|
            |0H|Phone Number Score is less than 3|
          minLength: 2
          maxLength: 2
    required:
      - color
  customerData:
    type: object
    properties:
      dateOfBirth:
        type: string
        description: Customer date of birth.</br> Date provided in 'YYYY-MM-DD' format as specified in RFC 3339
        format: date
      customerId:
        type: string
        description: Customer identifier
        minLength: 1
        maxLength: 32
  cardLastDigits:
    type: string
    description: The Card last 4 or 5 digits.
    minLength: 4
    maxLength: 5
  cryptoOTP:
    type: string
    description: Cryptographic OTP computed by Issuer backend and returned to the wallet during enrolment.</br> It will be checked by TSH if it's provided.
    maxLength: 3096
  provisionCardRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|
              |113|Unknown issuer|                           
              |116|Unknown card account|            
              |118|Unknown session|                               
              |161|Invalid crypto OTP|                    
              |164|Provisioning count exceeded|    
              |166|Invalid card information|
              |167|Card is already provisioned|              
              |170|Provisioning request declined|
              |171|Wallet account mismatch.<br/>The wallet account is already associated<br/>with a card under different customer name|                         
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
      walletCardId:
        $ref: '#/definitions/walletCardId'
      walletCardAccountId:
        $ref: '#/definitions/walletCardAccountId'
      cardDescriptor:
        $ref: '#/definitions/cardDescriptor'
    required:
      - responseHeader
  walletCardId:
    type: string
    description: The Wallet Card Identifier. Unique for each wallet card.
    minLength: 1
    maxLength: 64
  walletCardAccountId:
    type: string
    description: The Wallet Card Account Identifier. Unique for each wallet card account.
    minLength: 1
    maxLength: 64
  cardDescriptor:
    type: object
    description: The card descriptor which contains various metadata.</br>
    properties:
      appletCurrencyCode:
        type: string
        description: The apple currency code.</br> It is specified as 3 letters code (ISO4217)
        minLength: 3
        maxLength: 3
      displayCardNumber:
        type: string
        description: 'The card number to be displayed on the wallet.<br/> If it''s not provided, cardId will be used.'
        minLength: 1
        maxLength: 16
      cardholderName:
        type: string
        description: The card holder to be displayed on the wallet.
        minLength: 1
        maxLength: 128
      cardArtManifest:
        $ref: '#/definitions/cardArtManifest'
      labelColor:
        type: string
        description: Color of overlaying text
        pattern: '^rgb\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3}\)$'
      shortDescription:
        type: string
        description: A short description of the card.
        maxLength: 32
      longDescription:
        type: string
        description: A longer description of the card.
        maxLength: 64
      privacyPolicyURL:
        type: string
        description: URL pointing to issuer privacy policy
        maxLength: 128
      termsAndConditionsURL:
        type: string
        description: URL pointing to card terms and conditions
        maxLength: 128
      contactWebsite:
        type: string
        description: Customer service website of the issuer
        maxLength: 128
      contactEmail:
        type: string
        description: Customer service email address of the issuer
        maxLength: 32
      contactNumber:
        type: string
        description: 'Customer service phone number of the issuer.</br> This number is provided in standard, international format with country code'
        maxLength: 32
      contactName:
        type: string
        description: Customer service contact name of the issuer
        maxLength: 128
      cardActions:
        type: object
        properties:
          minLoadedBalance:
            type: number
            description: Minimum value amount a card can contain after applying a top-up action
          maxLoadedBalance:
            type: number
            description: Maximum value amount a card can contain after using a top-up action
          minLoadAmount:
            type: number
            description: Minimum amount that can be added during a top-up action per transaction
          maxLoadAmount:
            type: number
            description: Maximum amount that can be added during a top-up action per transaction
        required:
          - maxLoadedBalance
          - minLoadAmount
      commutePlans:
        type: array
        maxItems: 10
        items:
          type: object
          properties:
            identifier:
              type: string
              description: 'Identifier of a plan, unique to the list of plans.'
              minLength: 1
              maxLength: 128
            title:
              type: array
              maxItems: 10
              items:
                type: object
                properties:
                  label:
                    type: string
                    description: |-
                      Commute plan title label.</br> Examples:  - First Ferry Monthly Ticket
                        - First Ferry Weekly Ticket
                    minLength: 1
                    maxLength: 64
                  value:
                    type: string
                    description: 'Commute plan title extra details.</br> Examples:  - North Point - Hunghom - Kowloon City'
                    minLength: 1
                    maxLength: 64
                  language:
                    type: string
                    description: |-
                      Text language as defined by BCP 47 standard.</br> Examples:  - en-US
                        - zh-CN
                    minLength: 1
                    maxLength: 16
                required:
                  - label
                  - language
            usage:
              type: object
              properties:
                label:
                  type: string
                  enum:
                    - Usage
                    - Limitations
                  description: Label describing commute plan usage
                value:
                  type: array
                  maxItems: 10
                  items:
                    type: object
                    properties:
                      text:
                        type: string
                        description: Descriptive text about commute plan usage
                        minLength: 1
                        maxLength: 128
                      language:
                        type: string
                        description: |-
                          Text language as defined by BCP 47 standard.</br> Examples:  - en-US
                            - zh-CN
                        minLength: 1
                        maxLength: 16
                    required:
                      - text
                      - language
              required:
                - label
                - value
            validityPeriod:
              type: object
              properties:
                startDate:
                  type: string
                  description: |-
                    Starting date of the commute plan (can be in the future).<br/>RFC3339 format<br/> Examples:  - "2018-11-24T17:32:28Z"
                      - "2019-10-02T10:00:00-05:00"
                  format: date-time
                expiryDate:
                  type: string
                  description: |-
                    Ending date of the commute plan.<br/>RFC3339 format<br/> Examples:  - "2018-12-24T17:32:28Z"
                      - "2019-10-09T10:00:00-05:00"
                  format: date-time
                dateStyle:
                  type: string
                  enum:
                    - SHORT
                    - MEDIUM
                    - LONG
                  description: |-
                    Style of the date to be displayed on user device. Default value is "MEDIUM".</br> Examples:  - SHORT ==> "11/23/19"
                      - MEDIUM ==> "Nov 23, 2019"
                      - LONG ==> "November 23, 2019"
                timeStyle:
                  type: string
                  enum:
                    - SHORT
                    - MEDIUM
                    - LONG
                  description: |-
                    Style of the date to be displayed on user device. Default value is "SHORT".</br> Examples:  - SHORT ==> "3:30 PM"
                      - MEDIUM ==> "3:30:32 PM"
                      - LONG ==> "3:30:32 PM PST"
              required:
                - startDate
                - expiryDate
          required:
            - identifier
            - title
            - usage
            - validityPeriod
      mobileApp:
        type: object
        properties:
          identifier:
            type: string
            description: Identifier of the mobile application
            maxLength: 128
          action:
            type: string
            description: Mobile application native action.</br> Used for deep linking
            maxLength: 128
          intentExtraText:
            type: string
            description: Mobile application native intent extra text.</br> Used for deep linking
            maxLength: 128
        required:
          - identifier
    required:
      - appletCurrencyCode
      - labelColor
      - shortDescription
  manageCardReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      issuerId:
        $ref: '#/definitions/issuerId'
      walletCardId:
        $ref: '#/definitions/walletCardId'
      operation:
        $ref: '#/definitions/operation'
    required:
      - requestHeader
      - issuerId
      - walletCardId
      - operation
  operation:
    type: string
    enum:
      - SUSPEND
      - RESUME
      - PARK
      - DELETE
    description: 'The operation to perform on the card.</br> Note:</br> - PARK is to be used for an already provisioned card.</br> - Whereas DELETE is to be used for failed provisioning.'
  manageCardRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|
              |113|Unknown issuer|                                                        
              |119|Unknown virtual card|                         
              |432|Operation is not allowed with current card state|   
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
    required:
      - responseHeader
  sendScriptCallbackReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      taskId:
        $ref: '#/definitions/taskId'
      apduResponses:
        $ref: '#/definitions/apduResponses'
    required:
      - requestHeader
      - taskId
  taskId:
    type: string
    description: Unique task identifier used to correlate a callback to a request.
    minLength: 1
    maxLength: 64
  apduResponses:
    type: array
    description: List of APDU responses returned by secure element.
    items:
      type: object
      properties:
        rApdu:
          $ref: '#/definitions/rApdu'
        messageId:
          type: string
          description: ID of the command executed
          minLength: 1
          maxLength: 64
        messageName:
          type: string
          description: Descriptive name of the command that has been executed.</br> Extracted from the original message and appended with "_RESP"
          minLength: 1
          maxLength: 100
      required:
        - rApdu
        - messageId
  rApdu:
    type: string
    description: 'APDU response received from SE, encoded in Hex string.'
    pattern: '([0-9a-fA-F][0-9a-fA-F]){1,257}'
  sendScriptCallbackRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|              
              |121|Unknown task|                                      
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
    required:
      - responseHeader
  updateCardCallbackReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      taskId:
        $ref: '#/definitions/taskId'
      statusCode:
        type: number
        description: |
          Status code to the request
          |Status code | Description|
          |-------|-------|
          |0|OK|                                       
          |911|Operation failed|          
          |921|Unexpected server error|
      statusMessage:
        type: string
        description: Textual status message
    required:
      - requestHeader
      - taskId
      - statusCode
  updateCardCallbackRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|              
              |121|Unknown task|                                      
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
    required:
      - responseHeader
  getCardStatusReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      walletCardId:
        $ref: '#/definitions/walletCardId'
    required:
      - requestHeader
      - walletCardId
  getCardStatusRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|              
              |119|Unknown virtual card|                                     
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
      state:
        type: string
        enum:
          - CREATED
          - ACTIVE
          - SUSPENDED_WALLET
          - SUSPENDED_ISSUER
          - UNLINKED
    required:
      - responseHeader
  getCardAccountStatusReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      walletCardAccountId:
        $ref: '#/definitions/walletCardAccountId'
    required:
      - requestHeader
      - walletCardAccountId
  getCardAccountStatusRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|              
              |116|Unknown card account|                                  
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
      state:
        type: string
        enum:
          - ACTIVE
          - PARKED
          - CANCELLED
        description: The card account state
      accountBalance:
        type: object
        description: Represents the balance account attributes.
        properties:
          balanceAmount:
            type: number
            description: The current balance amount of the card
            format: double
          balanceCurrencyCode:
            type: string
            description: The currency of the purchase order.</br> It is specified as 3 letters code (ISO4217)
            minLength: 3
            maxLength: 3
          balanceDate:
            type: string
            description: |-
              Date time representing when the request or response has been generated.<br/>RFC3339 format.<br/> Examples:
                - "2018-12-24T17:32:28Z"
                - "2019-10-02T10:00:00-05:00"
            format: date-time
        required:
          - balanceAmount
          - balanceCurrencyCode
          - balanceDate
    required:
      - responseHeader
  getCardCommandsReq:
    type: object
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      mode:
        type: string
        enum:
          - PARK
          - REDIRECT
          - TOP-UP
        description: It is needed in the first request only.
      walletCardId:
        $ref: '#/definitions/walletCardId'
      apduResponses:
        $ref: '#/definitions/apduResponses'
    required:
      - requestHeader
      - walletCardId
  getCardCommandsRes:
    type: object
    properties:
      responseHeader:
        type: object
        properties:
          responseId:
            $ref: '#/definitions/responseId'
          sessionId:
            $ref: '#/definitions/sessionId'
          generationDateTime:
            $ref: '#/definitions/generationDateTime'
          statusCode:
            type: number
            description: |
              Status code to the request
              |Status code | Description|
              |-------|-------|
              |0|OK|      
              |111|Missing mandatory parameter|
              |112|Bad parameter format|      
              |117|Unknown device|       
              |118|Unknown session|
              |119|Unknown virtual card|                        
              |159|Card is blacklisted|
              |160|Card is deleted|               
              |162|Card has unsufficient balance|
              |163|Card product not eligible|                  
              |321|Operation already on-going for this device|
              |322|Time to live of the operation expired|                            
              |911|Operation failed|          
              |921|Unexpected server error|
          statusMessage:
            type: string
            description: Textual status message
        required:
          - responseId
          - sessionId
          - statusCode
      apduCommands:
        $ref: '#/definitions/apduCommands'
    required:
      - responseHeader
  apduCommands:
    type: array
    description: List of APDU commands to send to a secure element.
    items:
      type: object
      properties:
        cApdu:
          $ref: '#/definitions/cApdu'
        messageId:
          type: string
          description: ID of the command to execute
          minLength: 1
          maxLength: 64
        messageName:
          type: string
          description: Descriptive name of the command that needs to be executed.
          minLength: 1
          maxLength: 100
      required:
        - cApdu
        - messageId
  cApdu:
    type: string
    description: 'APDU Command sent to SE, encoded in Hex string.'
    pattern: '([0-9a-fA-F][0-9a-fA-F]){1,255}'
parameters:
  podHeader:
    name: x-pod
    in: header
    description: HTTP header identifying the pod and corresponding DNS hostname of the load balancer from which traffic is coming.</br> Subsequent API calls should be sent to this pod.
    required: true
    type: string
    maxLength: 128
