openapi: 3.0.0
info:
  title: Reserve Amount from Agent's Wallet
  description: >
    Reserve amount from agent's wallet for a not yet committed transaction. The
    SKU specified in the content will determine how the transaction will be
    committed.
paths:
  /api/rest:
    post:
      summary: setSale
      description: >
        Reserve amount from agent's wallet for a not yet committed transaction.
        The SKU specified in the content will determine how the transaction will
        be committed.
      operationId: setSale
      x-consumption-style: synchronous
      x-transaction-processing-style: synchronous
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                access_token:
                  type: string
                  maxLength: 500
                  example: abc123xyz456
                method:
                  type: string
                  maxLength: 64
                  example: POST
                version:
                  type: string
                  maxLength: 10
                  example: 1.0.0
                content:
                  type: object
                  properties:
                    msgId:
                      type: string
                      maxLength: 30
                      example: '0462023040123595999'
                      description: >-
                        Unique message ID generated by a 3rd party system.
                        Format AAAYYYYMMDDHH24MISSCCCC
                    channel:
                      type: string
                      maxLength: 20
                      example: '046'
                      description: Fixed value for each channel (e.g., 046 for UMB)
                    orgCode:
                      type: string
                      example: ORG123
                      description: Organization code
                    eloadNbr:
                      type: string
                      example: '10000001'
                      description: eLoad number (optional)
                    userCode:
                      type: string
                      example: USER001
                      description: User ID used in ZSmart UPortal
                    password:
                      type: string
                      example: rsaEncryptedPassword123
                      description: RSA encrypted password for ZSmart UPortal
                    extOrderNbr:
                      type: string
                      example: CRMORDER001
                      description: CRM order number, unique for each setSale attempt
                    sales:
                      type: array
                      items:
                        type: object
                        properties:
                          txnType:
                            type: string
                            enum:
                              - Payment
                              - Deposit
                            example: Payment
                            description: Transaction type (Payment/Deposit)
                          sku:
                            type: string
                            example: POSTPAID
                            description: >-
                              SKU of the transaction (required depending on
                              txnType)
                          msisdnSub:
                            type: string
                            example: '601112345678'
                            description: >-
                              MSISDN of subscriber (required when sku is
                              provided)
                          amount:
                            type: number
                            format: float
                            example: 50
                            description: Transaction amount (e.g., 50.00)
                          extTxnNbr:
                            type: string
                            example: EXTTXN001
                            description: >-
                              External transaction number, unique for each
                              transaction
                        required:
                          - txnType
                          - amount
                          - extTxnNbr
                        additionalProperties: false
                  required:
                    - msgId
                    - channel
                    - orgCode
                    - userCode
                    - password
                    - extOrderNbr
                    - sales
              required:
                - access_token
                - method
                - version
                - content
      responses:
        '200':
          description: Reservation successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  res_code:
                    type: string
                    maxLength: 10
                    example: '00000'
                    description: Response code (e.g., "00000" for success)
                  res_message:
                    type: string
                    maxLength: 255
                    example: Operation success
                    description: Response description (e.g., success message)
                  result:
                    type: object
                    description: Response result (optional).
                    properties:
                      eloadNbr:
                        type: string
                        example: '10000001'
                        description: eLoad number
                      resultCode:
                        type: string
                        example: DBEP0000
                        description: Success
                      resultMsg:
                        type: string
                        maxLength: 255
                        example: Success
                        description: Service result message
                      transactions:
                        type: array
                        items:
                          type: object
                          properties:
                            txnNbr:
                              type: string
                              example: TXN123456
                              description: Transaction number generated by eLoad
                            txnType:
                              type: string
                              enum:
                                - Payment
                                - Deposit
                              example: Payment
                              description: Transaction type
                            amount:
                              type: string
                              example: '50.00'
                              description: Amount to be deducted
                            txnTime:
                              type: string
                              example: '2023-04-01 23:59:59'
                              description: >-
                                Date and time of the transaction format
                                YYYY-MM-DD HH:MM:SS
                            eloadBeforeAmount:
                              type: string
                              example: '100.00'
                              description: The balance before the transaction was deducted
                            eloadAfterAmount:
                              type: string
                              example: '50.00'
                              description: The balance after the transaction was deducted
                            txnStatus:
                              type: string
                              enum:
                                - Reserve
                              example: Reserve
                              description: Transaction status (e.g., "Reserve")
                            extTxnNbr:
                              type: string
                              example: EXTTXN001
                              description: External system transaction ID, same as input
        '400':
          description: Invalid request
          content:
            application/json:
              example:
                res_code: '400'
                res_message: Invalid request data
        '500':
          description: Server error
          content:
            application/json:
              example:
                res_code: '500'
                res_message: Internal server error
components: {}
