x-generator: NSwag v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v11.0.0.0))
swagger: '2.0'
info:
  title: Absorb Integration API
  version: v1
consumes:
  - application/json
produces:
  - application/json
paths:
  /e-commerce/transactions/{transactionId}:
    get:
      tags:
        - E-commerce Transactions
      summary: Get e-commerce transaction.
      operationId: EcommerceTransactions_GetEcommerceTransactionById
      parameters:
        - type: string
          name: transactionId
          in: path
          required: true
          description: The E-commerce transaction ID.
          format: guid
          x-nullable: false
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '1'
      responses:
        '200':
          x-nullable: false
          description: ''
          schema:
            $ref: '#/definitions/EcommerceTransactionResource'
        '404':
          x-nullable: false
          description: Transaction not found.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
  /e-commerce/transactions:
    get:
      tags:
        - E-commerce Transactions
      summary: List e-commerce transactions.
      description: >-
        Can be filtered by userId, courseId, transactionDate,
        transactionCompletedDate, and paymentGatewayTransactionId.
      operationId: EcommerceTransactions_GetEcommerceTransactions
      parameters:
        - type: string
          name: userId
          in: query
          description: The specified user ID to filter by.
          format: guid
          x-nullable: true
        - type: string
          name: courseId
          in: query
          description: The specified course ID to filter by.
          format: guid
          x-nullable: true
        - type: string
          name: transactionDate
          in: query
          description: The specified creation date to filter by.
          format: date-time
          x-nullable: true
        - type: string
          name: transactionCompletedDate
          in: query
          description: The specified completion date to filter by.
          format: date-time
          x-nullable: true
        - type: string
          name: paymentGatewayTransactionId
          in: query
          description: The specified payment gateway transaction ID to filter by.
          x-nullable: true
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '1'
      responses:
        '200':
          x-nullable: false
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/EcommerceTransactionResource'
        '422':
          x-nullable: false
          description: A validation error occured with the provided parameters.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
  /e-commerce/transactions/{transactionId}/status:
    post:
      tags:
        - E-commerce Transactions
      summary: Approves or denies an e-commerce transaction.
      operationId: EcommerceTransactions_SetTransactionStatus
      parameters:
        - type: string
          name: transactionId
          in: path
          required: true
          description: The E-commerce transaction ID.
          format: guid
          x-nullable: false
        - name: status
          in: body
          description: The status of the transaction.
          schema:
            $ref: '#/definitions/SetTransactionStatusRequestBody'
          x-nullable: true
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '1'
      responses:
        '200':
          description: ''
        '404':
          x-nullable: false
          description: Enrollment course or shopping cart not found.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
        '409':
          x-nullable: false
          description: Shopping cart transaction invalid.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
        '422':
          x-nullable: false
          description: A validation error occured with the provided parameters.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
definitions:
  EcommerceTransactionResource:
    type: object
    description: >-
      Represents information about an Ecommerce transaction for an Integration
      API endpoint.
    properties:
      id:
        type: string
        description: The unique E-commerce transaction identifier.
        format: guid
      paymentGatewayTransactionId:
        type: string
        description: The transaction's payment gateway transaction ID.
      transactionDate:
        type: string
        description: The transaction's creation date.
      transactionCompletedDate:
        type: string
        description: >-
          The transaction's completion date (done by payment gateway or admin
          approval).
      status:
        type: string
        description: |-
          The transaction's status. 
          Possible values: Approved, Declined, PendingApproval
      details:
        type: array
        description: The transaction's shopping cart items.
        items:
          $ref: '#/definitions/EcommerceTransactionDetailResource'
      paymentMethod:
        description: >-
          The transaction's method of payment.


          Possible Enum Values: `1 = CreditCard` `2 = PayPal` `4 = WireTransfer`
          `8 = Check` `16 = PurchaseOrder` `32 = PawaPay` `64 = Adyen` 
        allOf:
          - $ref: '#/definitions/PaymentMethods'
      cardType:
        type: string
        description: The transaction's credit card type.
      maskedCardNumber:
        type: string
        description: The transaction's last 4 digits of the credit card.
      billingFirstName:
        type: string
        description: First name of the person responsible for payment.
      billingLastName:
        type: string
        description: Last name of the person responsible for payment.
      billingAddress:
        type: string
        description: Address of the person responsible for payment.
      billingEmailAddress:
        type: string
        description: Email address of the person responsible for payment.
      learnerEmailAddress:
        type: string
        description: Email address of the learner receiving the course/enrollment key(s).
      learnerFirstName:
        type: string
        description: First name of the learner receiving the course/enrollment key(s).
      learnerLastName:
        type: string
        description: Last name of the learner receiving the course/enrollment key(s).
      referenceNumber:
        type: string
        description: The transaction's reference number.
      couponCode:
        type: string
        description: The transaction's coupon code used.
      provinceTaxLabel:
        type: string
        description: The transaction's provincial tax name.
      provinceTax:
        type: number
        description: The transaction's dollar amount of provincial tax.
        format: decimal
      countryTaxLabel:
        type: string
        description: The transaction's country tax name.
      countryTax:
        type: number
        description: The transaction's dollar amount of country tax.
        format: decimal
      discount:
        type: number
        description: The transaction's dollar amount of discount.
        format: decimal
      subTotal:
        type: number
        description: The transaction's subtotal before taxes and discounts.
        format: decimal
      totalAmount:
        type: number
        description: The transaction's total amount actually paid.
        format: decimal
      paymentGatewayMessage:
        type: string
        description: The transaction's message from payment gateway.
      paymentGatewayResult:
        type: string
        description: >-
          The transaction's result from payment gateway. Meaning depends on type
          of payment gateway.
      paymentGatewayMessageCode:
        type: string
        description: >-
          The transaction's message code from payment gateway. Meaning depends
          on type of payment gateway.
      userId:
        type: string
        description: The transaction's user ID.
        format: guid
      isNewUser:
        type: boolean
        description: Indicates if this transaction was started by a new Absorb user.
      isRefunded:
        type: boolean
        description: Indicates if this transaction was refunded.
      refundDate:
        type: string
        description: The transaction's refund date.
      quantity:
        type: integer
        description: >-
          The transaction's quantity of seats purchased. This value applies to
          each shopping cart item.
        format: int32
  Link:
    type: object
    properties:
      Rel:
        $ref: '#/definitions/Relation'
      Items:
        type: array
        items:
          $ref: '#/definitions/LinkItem'
  Relation:
    type: object
    properties:
      Name:
        type: string
  LinkItem:
    type: object
    properties:
      Href:
        type: string
      Name:
        type: string
      Templated:
        type: boolean
      Type:
        type: string
      Deprecation:
        type: string
      Profile:
        type: string
      Title:
        type: string
      Hreflang:
        type: string
  IEmbeddedResource:
    type: object
    x-abstract: true
    properties:
      Name:
        type: string
      Resources:
        type: array
        items:
          $ref: '#/definitions/IResource'
  IResource:
    type: object
    x-abstract: true
    properties:
      Links:
        type: array
        items:
          $ref: '#/definitions/Link'
      EmbeddedResources:
        type: array
        items:
          $ref: '#/definitions/IEmbeddedResource'
  EcommerceTransactionDetailResource:
    type: object
    description: >-
      Represents information about an Ecommerce transaction shopping cart item
      for an Integration API endpoint.
    properties:
      id:
        type: string
        description: The unique shopping cart item identifier.
        format: guid
      courseId:
        type: string
        description: The unique course identifier.
        format: guid
      courseName:
        type: string
        description: The shopping cart item's course name.
      sessionId:
        type: string
        description: The unique ILC session identifier (if applicable).
        format: guid
      sessionName:
        type: string
        description: The shopping cart item's ILC session name (if applicable).
      price:
        type: number
        description: The shopping cart item's course price.
        format: decimal
  PaymentMethods:
    type: integer
    description: >-
      This enum uses bit shifted values to allow us to combine the values into a
      single bit field integer, allowing one integer to represent multiple
      pieces of information.  

      This is used to answer the question 'What payment methods are supported?'
      where we can return a single bit field that contains all the values 

      (so you could say 'myPaymentMethod = CreditCard | PayPal' to generate an
      integer that represents two acceptable methods of payment).

      Note: This has caused lots of problems and should not be used as an
      example for future development.

      Note: this enum has a hack in the t4ts because of the bit shifted values.

      Note: If changes are made to this enum, make sure you reflect them in
      AbsorbLMS.Katana.Enums.PaymentMethodsWrapper.
    x-enumFlags: true
    x-enumNames:
      - CreditCard
      - PayPal
      - WireTransfer
      - Check
      - PurchaseOrder
      - PawaPay
      - Adyen
    enum:
      - 1
      - 2
      - 4
      - 8
      - 16
      - 32
      - 64
  GenericErrorResponse:
    type: object
    description: |-
      This class is NOT to be used as an actual response. This is to be used as
      the return type for non-200 responses in `SwaggerResponse` attributes.
    properties:
      validations:
        type: array
        description: The validations (if any) which caused the error.
        items:
          type: string
      code:
        description: The status code returned.
        allOf:
          - $ref: '#/definitions/HttpStatusCode'
      message:
        type: string
        description: The error message.
      term:
        type: string
        description: The general error term.
      _meta:
        type: object
        description: 'A list of meta data (if any). '
        additionalProperties:
          type: string
  HttpStatusCode:
    type: integer
    description: ''
    x-enumNames:
      - Continue
      - SwitchingProtocols
      - OK
      - Created
      - Accepted
      - NonAuthoritativeInformation
      - NoContent
      - ResetContent
      - PartialContent
      - MultipleChoices
      - Ambiguous
      - MovedPermanently
      - Moved
      - Found
      - Redirect
      - SeeOther
      - RedirectMethod
      - NotModified
      - UseProxy
      - Unused
      - TemporaryRedirect
      - RedirectKeepVerb
      - BadRequest
      - Unauthorized
      - PaymentRequired
      - Forbidden
      - NotFound
      - MethodNotAllowed
      - NotAcceptable
      - ProxyAuthenticationRequired
      - RequestTimeout
      - Conflict
      - Gone
      - LengthRequired
      - PreconditionFailed
      - RequestEntityTooLarge
      - RequestUriTooLong
      - UnsupportedMediaType
      - RequestedRangeNotSatisfiable
      - ExpectationFailed
      - UpgradeRequired
      - InternalServerError
      - NotImplemented
      - BadGateway
      - ServiceUnavailable
      - GatewayTimeout
      - HttpVersionNotSupported
  SetTransactionStatusRequestBody:
    type: object
    description: The request to set an Ecommerce transaction status.
    properties:
      status:
        type: string
        description: |-
          Status of the transaction.
          Accepted values:
          - Approved
          - Declined
securityDefinitions:
  api_key:
    type: apiKey
    name: x-api-key
    in: header
tags:
  - name: E-commerce Transactions
x-servers:
  - url: https://rest.myabsorb.com
    description: US
  - url: https://rest.myabsorb.ca
    description: CA
  - url: https://rest.myabsorb.eu
    description: EU
  - url: https://rest.myabsorb.com.au
    description: AU
