openapi: 3.0.2
info:
  title: Remittance advice API
  description: Remittance advice API gives authorized customers the ability to send remittance advice information. See the full list of <a href="https://e2e.ti.com/support/enterprise-automation-integration-group/enterprise-automation-integration/f/enterprise-automation-integration-forum/1417978/faq-ti-api-store-remittance-advice-api-error-codes-and-meanings">error codes and detail descriptions</a>. <br /><br /> **Note:** Remittance advice API is only available to customers with a TI line of credit.
  version: 2.0.0
  contact:
    name: API Support
    url: https://www.ti.com/developer-api/support.html
servers:
- url: 'https://transact.ti.com/v2'
  description: Production
paths:
  /store/remittance-advice/:
    post:
      description: Send remittance advice.
      tags:
      - Remittance advice
      requestBody:
        description: 'Remittance advice request'
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/remittanceAdviceRequest'
            example:
              remittanceAdviceNumber: CustomerRemit100
              currencyCode: USD
              lineItems:
              - paymentAmount: '2000'
                financialDocumentNumber: '1234567890'
              - paymentAmount: '200'
                financialDocumentNumber: '234567890'

      responses:
        '201':
          description: Remittance advice created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/remittanceAdviceResponse'
              example:
                tiRemittanceAdviceNumber: '06CustomerRemit100'
                remittanceAdviceNumber: 'CustomerRemit100'
                currencyCode: 'USD'
                messages:
                - code: 'TI-TXT-012013'
                  type: 'SUCCESS'
                  reason: 'Remittance Advice 06CustomerRemit1 posted.'
                  message: 'Remittance Advice 06CustomerRemit1 posted.'
                lineItems:
                - paymentAmount: '2000'
                  financialDocumentNumber: '1234567890'
                - paymentAmount: '200'
                  financialDocumentNumber: '234567890'
        '422':
          description: Unprocessable entity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/remittanceAdviceResponse'
              example:
                remittanceAdviceNumber: CustomerRemit100
                currencyCode: USD
                lineItems:
                - paymentAmount: '200'
                  financialDocumentNumber: '1234567890'
                - paymentAmount: '2000'
                  messages:
                  - code: ERR-TICOM-REMIT-API-0110
                    type: ERROR
                    reason: Missing financialDocumentNumber
                    message: financialDocumentNumber cannot be null or empty. Enter a valid financialDocumentNumber and resubmit request.


        '400':
          description: 400 Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0400
                  type: BadRequest
                  reason: Bad Request
                  message: Please provide a valid date range.
        '401':
          description: Not authorized. OAuth credentials were missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0401
                  type: Security
                  reason: "Invalid Credentials"
                  message: "Provide a valid Bearer token"
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0404
                  type: ResourceNotFound
                  reason: "Resource could not be found"
                  message: "Order not found for 'DOESNOTEXIST'"
        '405':
          description: Method not allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0405
                  type: Validation
                  reason: Invalid method
                  message: "PATH is not a supported method."

        '429':
          description: >-
            Too many requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0429
                  type: Security
                  reason: Too many requests
                  message: Rate Limit Quota Hit.

        '500':
          description: System error.  The response should contain error details, including Execution ID, with which TI API support team can investigate.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0500
                  type: Unknown
                  reason: Service unavailable
                  message: This service is temporarily unavailable. Please contact support.

        '503':
          description: Service unavailable.  This may occur due to API gateway issue or when client quota has been reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0556
                  type: Unknown
                  reason: Service unavailable
                  message: This service is temporarily unavailable. Please contact support.

  /store/remittance-advice/test:
    post:
      description: Send remittance advice.
      tags:
      - Remittance advice
      requestBody:
        description: 'Remittance advice request'
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/remittanceAdviceRequest'
            example:
              remittanceAdviceNumber: CustomerRemit100
              currencyCode: USD
              lineItems:
              - paymentAmount: '2000'
                financialDocumentNumber: '1234567890'
              - paymentAmount: '200'
                financialDocumentNumber: '234567890'

      responses:
        '201':
          description: Remittance advice created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/remittanceAdviceResponse'
              example:
                tiRemittanceAdviceNumber: '06CustomerRemit100'
                remittanceAdviceNumber: 'CustomerRemit100'
                currencyCode: 'USD'
                messages:
                - code: 'TI-TXT-012013'
                  type: 'SUCCESS'
                  reason: 'Remittance Advice 06CustomerRemit1 posted.'
                  message: 'Remittance Advice 06CustomerRemit1 posted.'
                lineItems:
                - paymentAmount: '2000'
                  financialDocumentNumber: '1234567890'
                - paymentAmount: '200'
                  financialDocumentNumber: '234567890'
        '422':
          description: Unprocessable entity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/remittanceAdviceResponse'
              example:
                remittanceAdviceNumber: CustomerRemit100
                currencyCode: USD
                lineItems:
                - paymentAmount: '200'
                  financialDocumentNumber: '1234567890'
                - paymentAmount: '2000'
                  messages:
                  - code: ERR-TICOM-REMIT-API-0110
                    type: ERROR
                    reason: Missing financialDocumentNumber
                    message: financialDocumentNumber cannot be null or empty. Enter a valid financialDocumentNumber and resubmit request.


        '400':
          description: 400 Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0400
                  type: BadRequest
                  reason: Bad Request
                  message: Please provide a valid date range.
        '401':
          description: Not authorized. OAuth credentials were missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0401
                  type: Security
                  reason: "Invalid Credentials"
                  message: "Provide a valid Bearer token"
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0404
                  type: ResourceNotFound
                  reason: "Resource could not be found"
                  message: "Order not found for 'DOESNOTEXIST'"
        '405':
          description: Method not allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0405
                  type: Validation
                  reason: Invalid method
                  message: "PATH is not a supported method."

        '429':
          description: >-
            Too many requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0429
                  type: Security
                  reason: Too many requests
                  message: Rate Limit Quota Hit.

        '500':
          description: System error.  The response should contain error details, including Execution ID, with which TI API support team can investigate.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0500
                  type: Unknown
                  reason: Service unavailable
                  message: This service is temporarily unavailable. Please contact support.

        '503':
          description: Service unavailable.  This may occur due to API gateway issue or when client quota has been reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                errors:
                - errorCode: TI-API-0556
                  type: Unknown
                  reason: Service unavailable
                  message: This service is temporarily unavailable. Please contact support.

components:
  schemas:
    remittanceAdviceRequest:
      type: object
      required:
      - currencyCode
      - lineItems
      properties:
        remittanceAdviceNumber:
          type: string
          maxLength: 35
          description: Customer remittance advice number.
        currencyCode:
          type: string
          maxLength: 3
          description: Customer payment currency. ISO 3 character currency code matching the currency used on the original order(s). For example USD, CNY, JPY, EUR
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/lineItemsRequest'
    remittanceAdviceResponse:
      type: object
      properties:
        tiRemittanceAdviceNumber:
          type: string
          description: Resulting supplier remittance advice number if the transaction succeeded.
        remittanceAdviceNumber:
          type: string
          description: Customer remittance advice number.
        currencyCode:
          type: string
          description: Customer payment currency.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/headerLevelMessage'
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/lineItemsResponse'
    headerLevelMessage:
      type: object
      properties:
        code:
          type: string
          description: Message code.
        type:
          type: string
          description: Message type. Possible values can be SUCCESS, ERROR or INFO.
        reason:
          type: string
          description: Indicates the reason for this error.
        message:
          type: string
          description: Message content.
    message:
      type: object
      properties:
        code:
          type: string
          description: Message code.
        type:
          type: string
          description: Message type. Possible values can be SUCCESS, ERROR or INFO.
        reason:
          type: string
          description: Indicates the reason for this error.
        message:
          type: string
          description: Message content.
    lineItemsRequest:
      type: object
      required:
      - paymentAmount
      - financialDocumentNumber
      properties:
        paymentAmount:
          type: string
          maxLength: 15
          description: Customer net payment amount.
        financialDocumentNumber:
          type: string
          maxLength: 10
          description: Supplier financial document number.
    lineItemsResponse:
      type: object
      properties:
        paymentAmount:
          type: string
          maxLength: 15
          description: Customer net payment amount.
        financialDocumentNumber:
          type: string
          maxLength: 10
          description: Supplier financial document number.
        customerFinancialDocumentNumber:
          type: string
          maxLength: 10
          description: Customer financial document number.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/message'
    errorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    error:
      type: object
      properties:
        errorCode:
          type: string
          description: Indicates an error code that was assigned to trouble-shoot with TI support team.
        type:
          type: string
          description: Indicates the type of error, for example, Validation Error.
        reason:
          type: string
          description: Indicates the reason for this error.
        message:
          type: string
          description: Indicates suggested action to take to correct the error.
  securitySchemes:
    OAuth2:
      type: oauth2
      description: 'This API uses OAuth 2 with the Client Credentials: https://api-portal.ti.com/store-api-authentication'
      flows:
        clientCredentials:
          tokenUrl: 'https://transact.ti.com/v1/oauth/accesstoken'
          refreshUrl: 'https://transact.ti.com/v1/oauth/accesstoken'
          scopes: {}
