openapi: 3.0.0
info:
  title: Message Gateway REST API
  version: 1.0.0
servers:
  - url: http://messagegatewayservice.stage-infra.svc:8080/MessageGatewayService/api
  - url: http://membership-service.dev-origination.svc:8080/api/v1
tags:
  - name: msg
    description: Messaging REST service
paths:
  /msg/email:
    post:
      tags:
        - msg
      summary: Send an email msg to a recipient
      parameters:
        - in: header
          name: api_key
          schema:
            type: string
          required: true
      requestBody:
        description: ''
        required: false
        content:
          application/json:
            schema:
              properties:
                payload:     # <--- form field that contains the JSON message
                  $ref: '#/components/schemas/EmailRequest'
      responses:
        '200': 
          description: Success Email response
  /msg/sms:
    post:
      tags:
        - msg
      summary: Send an email msg to a recipient
      parameters:
        - in: header
          name: api_key
          schema:
            type: string
          required: true
      requestBody:
        description: ''
        required: false
        content:
          application/json:
            schema:
              properties:
                payload:     # <--- form field that contains the JSON message
                  $ref: '#/components/schemas/SmsRequest'
      responses:
        '200':
          description: Success SMS response
  /common/membership/{membershipId}:
    get:
      tags:
        - common/membership
      summary: retrieves a memberships details
      parameters:
        - name: membershipId
          in: path
          description: ''
          required: true
          schema:
            type: string
            default: '14401761'
      responses:
        '200':
          description: Membership Detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MembershipReadDM'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsType'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsType'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsType'
components:
  schemas:
    EmailMessage:
      type: object
      properties:
        email_from:
          type: string
        email_to:
          type: string
        email_subject:
          type: string
        email_content:
          type: string
        email_template:
          type: string
        template_args:
          type: object
          additionalProperties:
            type: string
        html_content_type:
          type: boolean
    EmailRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/EmailMessage'
    SmsMessage:
      type: object
      properties:
        content:
          type: string
        destination_number:
          type: string
        source_number:
          type: string
        scheduled:
          type: string
        message_expiry_timestamp:
          type: string
        format:
          type: string
        sms_template:
          type: string
        template_args:
          type: object
          additionalProperties:
            type: string
    SmsRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/SmsMessage'
    Meta:
      type: object
    OtherPhone:
      type: object
      properties:
        areaCode:
          type: string
          example: '07'
          minLength: 0
          maxLength: 10
          pattern: '^[0-9 \+-]*$'
        phoneNumber:
          type: string
          example: '46111222'
          minLength: 0
          maxLength: 30
          pattern: '^[0-9 \+-]*$'
        description:
          type: string
          example: Work Phone
          minLength: 0
          maxLength: 99
          pattern: '^[\x20-\x7E]*'
    ErrorsType:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorType'
      x-className:
        type: string
        format: au.com.heritage.rest.model.errors.ErrorsType
    MembershipServiceDM:
      type: object
      properties:
        membershipClass:
          type: string
          enum:
            - MEMBER
            - TREASURY
            - NONMEMBER
            - MAILINGLIST
            - BULKPAYEE
            - PROSPECT
            - TRUST
            - STAFF
            - HBSDEPT
            - HBSBRANCH
        membershipType:
          type: string
          enum:
            - PERSONAL
            - COMPANY
            - PARTNERSHIP
            - TRUST
            - SUPERANNUATION
            - DECEASED
            - OTHER
        newMemberFlag:
          type: boolean
          default: false
        operationDetails:
          $ref: '#/components/schemas/OperationDetails'
        communicationPreference:
          $ref: '#/components/schemas/Marketing'
        parties:
          type: array
          items:
            $ref: '#/components/schemas/PartyMS'
          maxItems: 10
          minItems: 1
      x-className:
        type: string
        format: au.com.heritage.membership.service.model.MembershipServiceDM
    PartyReadDM:
      type: object
      properties:
        partyUniqueId:
          type: integer
          format: int32
        partyType:
          type: array
          items:
            type: string
            enum:
              - ACCOUNT_HOLDER
              - AUTHORISED_SIGNATORY
              - ADDITIONAL_CARDHOLDER
              - TOKEN_HOLDER
              - GUARANTOR
              - MORTGAGOR
              - POWER_OF_ATTORNEY
              - EXECUTOR
              - ENQUIRY_ACCESS_ONLY
              - CHAIRMAN
              - DIRECTOR
              - SECRETARY
              - TREASURER
              - EQUIVALENT_OFFICER
              - TRUSTEE
              - BENEFICIARY
              - BENEFICIAL_OWNER
              - PARTNER
              - SOLICITOR_BENEFICIARIES
              - ACCOUNT_HOLDER_NON_BORROWER
              - ACCOUNT_HOLDER_BORROWER
              - SETTLER
        personalDetails:
          $ref: '#/components/schemas/PersonalDetails'
        phoneNumbers:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumber'
        addresses:
          $ref: '#/components/schemas/PhysicalAddress'
        occupation:
          $ref: '#/components/schemas/AbsOccupation'
        membershipLinkingId:
          type: string
        isPrimaryContact:
          type: boolean
          default: false
    DocumentDatesType:
      type: object
      properties:
        startDate:
          type: string
        endDate:
          type: string
    Marketing:
      type: object
      properties:
        marketingMailFlag:
          type: boolean
          default: false
        doNotMailReason:
          type: string
          enum:
            - MEMBER_REQUEST
            - MISCELLANEOUS
            - RETURNED_MAIL
            - MEMBER_DECEASED
            - FRAUD_DEFAULT
            - BLANK
        marketingPhoneFlag:
          type: boolean
          default: false
        doNotPhoneReason:
          type: string
          enum:
            - MEMBER_REQUEST
            - MISCELLANEOUS
            - RETURNED_MAIL
            - MEMBER_DECEASED
            - FRAUD_DEFAULT
            - BLANK
        marketingSmsFlag:
          type: boolean
          default: false
        doNotSmsReason:
          type: string
          enum:
            - MEMBER_REQUEST
            - MISCELLANEOUS
            - RETURNED_MAIL
            - MEMBER_DECEASED
            - FRAUD_DEFAULT
            - BLANK
        marketingEmailFlag:
          type: boolean
          default: false
        doNotEmailReason:
          type: string
          enum:
            - MEMBER_REQUEST
            - MISCELLANEOUS
            - RETURNED_MAIL
            - MEMBER_DECEASED
            - FRAUD_DEFAULT
            - BLANK
        electronicCommunicationFlagOther:
          type: boolean
          default: false
        electronicCommunicationFlagLoans:
          type: boolean
          default: false
        operationDetails:
          $ref: '#/components/schemas/OperationDetails'
    OperationDetails:
      type: object
      properties:
        operatorId:
          type: string
          example: '000'
        branchId:
          type: string
          example: '000'
        date:
          type: string
          example: '2020-09-15'
        time:
          type: string
          example: '13:00'
    ErrorType:
      type: object
      required:
        - code
        - detail
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
    Phone:
      type: object
      properties:
        areaCode:
          type: string
          example: '07'
          minLength: 0
          maxLength: 10
          pattern: '^[0-9 \+-]*$'
        phoneNumber:
          type: string
          example: '46111222'
          minLength: 0
          maxLength: 30
          pattern: '^[0-9 \+-]*$'
    PartyMS:
      type: object
      properties:
        mainApplicant:
          type: boolean
          example: true
          default: false
        partyUniqueId:
          type: string
          example: '1'
          pattern: ^\d*$
        partyType:
          type: array
          items:
            type: string
            enum:
              - ACCOUNT_HOLDER
              - AUTHORISED_SIGNATORY
              - ADDITIONAL_CARDHOLDER
              - TOKEN_HOLDER
              - GUARANTOR
              - MORTGAGOR
              - POWER_OF_ATTORNEY
              - EXECUTOR
              - ENQUIRY_ACCESS_ONLY
              - CHAIRMAN
              - DIRECTOR
              - SECRETARY
              - TREASURER
              - EQUIVALENT_OFFICER
              - TRUSTEE
              - BENEFICIARY
              - BENEFICIAL_OWNER
              - PARTNER
              - SOLICITOR_BENEFICIARIES
              - ACCOUNT_HOLDER_NON_BORROWER
              - ACCOUNT_HOLDER_BORROWER
              - SETTLER
        entityType:
          type: string
          enum:
            - INDIVIDUAL
            - SOLE_TRADER
            - COMPANY
            - TRUST
            - PARTNERSHIP
            - ASSOCIATION
            - COOPERATIVE
            - GOVERNMENT_BODY
            - SOLICITORS_ACCOUNT
            - COMBINATION
            - OTHER
        personalDetails:
          $ref: '#/components/schemas/PersonalDetails'
        identificationDetails:
          type: array
          items:
            $ref: '#/components/schemas/IdentificationDetail'
        phoneNumbers:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumber'
        emailAddresses:
          type: array
          items:
            type: string
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/MembershipAddress'
        occupation:
          $ref: '#/components/schemas/AbsOccupation'
        kycDate:
          type: string
          format: date
          example: '2020-09-15'
        isPrimaryContact:
          type: boolean
          default: false
    ResidentialAddress:
      type: object
      properties:
        propertyName:
          type: string
          example: Hermiton
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        unitNumber:
          type: string
          example: u1
          minLength: 0
          maxLength: 5
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        streetNumber:
          type: string
          example: '999'
          minLength: 0
          maxLength: 8
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        streetName:
          type: string
          example: Joestar
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        streetType:
          type: string
          example: St
          minLength: 1
          maxLength: 30
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        suburb:
          type: string
          example: Toowoomba
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        state:
          type: string
          example: QLD
          minLength: 1
          maxLength: 4
          pattern: '^[A-Za-z]*$'
        postcode:
          type: string
          example: '4350'
          minLength: 1
          maxLength: 4
          pattern: ^\d*$
        countryCode:
          type: string
          example: AUS
          minLength: 0
          maxLength: 4
          pattern: ^\w*$
        dateCommencedAt:
          type: string
          format: date
          example: '2010-01-22'
    SimpleAddress:
      type: object
      properties:
        addressLine1:
          type: string
        suburb:
          type: string
        state:
          type: string
        postcode:
          type: string
        countryCode:
          type: string
    MembershipServiceSuccessResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/MembershipResponse'
        links:
          $ref: '#/components/schemas/Links'
        meta:
          $ref: '#/components/schemas/Meta'
      x-className:
        type: string
        format: au.com.heritage.membership.service.model.MembershipServiceSuccessResponse
    AbsOccupation:
      type: object
      properties:
        code:
          type: string
        description:
          type: string
        industryCode:
          type: string
    ComplexAddress:
      type: object
      properties:
        propertyName:
          type: string
        unitNumber:
          type: string
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        streetNumber:
          type: string
          example: '5'
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        streetName:
          type: string
          example: Larkin
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        streetType:
          type: string
          example: St
          minLength: 1
          maxLength: 30
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        postcode:
          type: string
          example: '2565'
          minLength: 1
          maxLength: 4
          pattern: ^\d*$
        suburb:
          type: string
          example: BARDIA
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        state:
          type: string
          example: NSW
          minLength: 1
          maxLength: 4
          pattern: '^[A-Za-z]*$'
        countryCode:
          type: string
          example: AUS
          minLength: 0
          maxLength: 4
          pattern: ^\w*$
    MembershipAddress:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/ComplexAddress'
        nonStdAddress:
          type: string
        addressType:
          type: string
          enum:
            - RESIDENTIAL
            - MAILLING
        deliveryPointID:
          type: string
        periodMonths:
          type: string
          example: '12'
          pattern: ^\d*$
        startDate:
          type: string
          example: '2018-09-15'
        current:
          type: boolean
          default: false
    KYCDetails:
      type: object
      properties:
        personalDetails:
          $ref: '#/components/schemas/KYCPersonalDetails'
        residentialAddress:
          $ref: '#/components/schemas/ResidentialAddress'
        mailingAddress:
          $ref: '#/components/schemas/MailingAddress'
        occupation:
          $ref: '#/components/schemas/Occupation'
        homePhone:
          $ref: '#/components/schemas/Phone'
        workPhone:
          $ref: '#/components/schemas/Phone'
        mobilePhone:
          type: string
          example: 0412345678
          minLength: 0
          maxLength: 30
          pattern: '^[0-9 \+-]*$'
        otherPhone:
          $ref: '#/components/schemas/OtherPhone'
        kycDate:
          type: string
          format: date
          example: '2020-09-15'
      x-className:
        type: string
        format: au.com.heritage.membership.service.model.KYCDetails
    MembershipResponse:
      type: object
      properties:
        membershipId:
          type: string
    PhysicalAddress:
      type: object
      properties:
        residentialAddress:
          $ref: '#/components/schemas/ComplexAddress'
        mailingAddress:
          $ref: '#/components/schemas/SimpleAddress'
    KYCPersonalDetails:
      type: object
      properties:
        gender:
          type: string
          example: M
          enum:
            - M
            - F
            - O
        title:
          type: string
          example: Mr
          minLength: 0
          maxLength: 10
          pattern: '^[0-9a-zA-Z\-&'' ]*$'
        nickname:
          type: string
          example: JoJo
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-&'' ]*$'
        maritalStatus:
          type: string
          example: SINGLE
          enum:
            - SINGLE
            - MARRIED
            - DEFACTO
            - SEPARATED
            - DIVORCED
            - WIDOWED
            - OTHER
        residentialStatus:
          type: string
          example: OWNER
          enum:
            - BUYER
            - OWNER
            - RENT
            - LIVE_WITH_PARENTS
            - BOARD
            - CARAVAN
            - UNKNOWN_OTHER
        driversLicence:
          type: string
          example: 12a34b56c
          minLength: 0
          maxLength: 20
          pattern: '^[0-9a-zA-Z ]*$'
    MailingAddress:
      type: object
      properties:
        fullAddress:
          type: string
          example: Hermiton Estate U1 999 Joestar St
          minLength: 1
          maxLength: 99
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        suburb:
          type: string
          example: Toowoomba
          minLength: 1
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-)(,'' ]*$'
        state:
          type: string
          example: QLD
          minLength: 1
          maxLength: 4
          pattern: '^[A-Za-z]*$'
        postcode:
          type: string
          example: '4350'
          minLength: 1
          maxLength: 4
          pattern: ^\d*$
    PersonalDetails:
      type: object
      properties:
        gender:
          type: string
          example: M
          enum:
            - M
            - F
            - O
        nameTitle:
          type: string
          example: Mr
          minLength: 0
          maxLength: 10
          pattern: '^[0-9a-zA-Z\-&'' ]*$'
        givenNames:
          type: string
          example: Joseph Hermit Purple
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-&'' ]*$'
        surname:
          type: string
          example: Joestar
          minLength: 1
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-&'' ]*$'
        nickname:
          type: string
          example: JoJo
          minLength: 0
          maxLength: 50
          pattern: '^[0-9a-zA-Z\-&'' ]*$'
        dateOfBirth:
          type: string
          format: date
          example: '1920-09-27'
        maritalStatus:
          type: string
          example: SINGLE
          enum:
            - SINGLE
            - MARRIED
            - DEFACTO
            - SEPARATED
            - DIVORCED
            - WIDOWED
            - OTHER
        residentialStatus:
          type: string
          example: OWNER
          enum:
            - BUYER
            - OWNER
            - RENT
            - LIVE_WITH_PARENTS
            - BOARD
            - CARAVAN
            - UNKNOWN_OTHER
        driverLicence:
          type: string
          example: 12a34b56c
          minLength: 0
          maxLength: 20
          pattern: '^[0-9a-zA-Z ]*$'
    MembershipData:
      type: object
      properties:
        membershipClassList:
          type: array
          items:
            type: string
            enum:
              - MEMBER
              - TREASURY
              - NONMEMBER
              - MAILINGLIST
              - BULKPAYEE
              - PROSPECT
              - TRUST
              - STAFF
              - HBSDEPT
              - HBSBRANCH
        membershipType:
          type: string
          enum:
            - PERSONAL
            - COMPANY
            - PARTNERSHIP
            - TRUST
            - SUPERANNUATION
            - DECEASED
            - OTHER
        dateJoined:
          type: string
        dateResigned:
          type: string
        hardshipStatusType:
          type: string
          enum:
            - NEVER_IN_HARDSHIP
            - NO_LONGER_IN_HARDSHIP
            - IN_HARDSHIP_LINKED
            - APPLIED_FOR_HARDSHIP
        emails:
          type: array
          uniqueItems: true
          items:
            type: string
        isPriorityRelationship:
          type: boolean
          default: false
    Occupation:
      type: object
      properties:
        code:
          type: string
          example: '111'
          minLength: 0
          maxLength: 4
          pattern: '^[0-9a-zA-Z ]*$'
        description:
          type: string
          example: Noble Lord of Hermiton Estate
          minLength: 0
          maxLength: 99
          pattern: '^[\x20-\x7E]*'
        industryCode:
          type: string
          example: '1'
          minLength: 0
          maxLength: 4
          pattern: '^[0-9a-zA-Z ]*$'
    MembershipReadDM:
      type: object
      properties:
        membershipData:
          $ref: '#/components/schemas/MembershipData'
        communicationPreferences:
          $ref: '#/components/schemas/Marketing'
        parties:
          type: array
          items:
            $ref: '#/components/schemas/PartyReadDM'
      x-className:
        type: string
        format: au.com.heritage.membership.service.model.MembershipReadDM
    PhoneNumber:
      type: object
      properties:
        purpose:
          type: string
          example: HOME_MOBILE
          enum:
            - WORK_PHONE
            - WORK_MOBILE
            - HOME_PHONE
            - HOME_MOBILE
        fixedPhone:
          $ref: '#/components/schemas/FixedPhone'
        mobile:
          type: string
          example: '0401010101'
          minLength: 0
          maxLength: 30
          pattern: '^[0-9 \+-]*$'
    Links:
      type: object
      properties:
        self:
          type: string
    IdentificationDetail:
      type: object
      properties:
        documentType:
          type: string
          example: PASSPORT_AUS
          enum:
            - EXISTING_CUSTOMER
            - DRIVERS_LICENCE_AUST
            - PASSPORT_AUS
            - PASSPORT_FOREIGN
            - PROOF_OF_AGE_AUST
            - BIRTH_CERTIFICATE_AUST
            - BIRTH_CERTIFICATE_FOREIGN
            - AUST_CITIZENSHIP_CERT
            - GOVT_HEALTH_CARD
            - GOVT_PENSION_CARD
            - INDIG_COMMUNITY_REF
            - GOVT_NOTICE
            - UTILITY_STATEMENT
            - SCHOOL_PRINCIPLE_NOTICE
            - DEPT_HUMAN_RESOURCES
            - MORTGAGE_OTHER_FIN
            - DEED_POLL
            - MARRIAGE_CERTIFICATE
            - BANK_CREDIT_CARD
            - MEDICARE_CARD
            - RENTAL_AGREEMENT
            - ATO_NOTICE
            - STUDENT_ID_CARD
            - AML_OVERRIDE
            - ONLINE_VERIFICATION
            - GOVT_IMMICARD
            - DIVORCE_PAPERS
            - GOVT_GUN_LICENCE
            - GOVT_BOAT_LICENCE
            - AUST_DEFENCE_ID
            - AGED_CARE_NOTICE
            - VEVO_CHECK
            - ELECTRONIC_VERIFICATION
            - BANK_AT_POST
        documentId:
          type: string
          example: PA-11111111
        onlineIdVerificationFlag:
          type: boolean
          example: false
          default: false
        onlineIdVerificationScore:
          type: string
        description:
          type: string
          example: Australian Passport
        documentDates:
          $ref: '#/components/schemas/DocumentDatesType'
        issuedBy:
          type: string
          example: GOVERNMENT
        placeOfIssue:
          type: string
          example: QLD
        points:
          type: string
          example: '100'
        signatureFlag:
          type: boolean
          example: false
          default: false
    FixedPhone:
      type: object
      properties:
        areaCode:
          type: string
          pattern: '\d{0,5}'
        phoneNumber:
          type: string
          pattern: '\d{0,15}'
  securitySchemes:
    apikey:        # arbitrary name for the security scheme
      type: apiKey
      in: header       # can be "header", "query" or "cookie"
      name: api_key  # name of the header, query parameter or cookie
security:
  - apikey: []