Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NAB

Hierarchy

  • NAB

Index

Constructors

constructor

  • new NAB(config: { merchantId: string; password: string; testMode: boolean; timeout?: string }): NAB
  • Creates an instance of the NAB class.

    Parameters

    • config: { merchantId: string; password: string; testMode: boolean; timeout?: string }

      Config.

      • merchantId: string

        5 character merchant ID supplied by NAB Transact.

      • password: string

        Transaction password. Password used for authentication of the merchant's request message, supplied by NAB Transact.

      • testMode: boolean
      • Optional timeout?: string

    Returns NAB

Properties

Private baseUrl

baseUrl: string

Private merchantId

merchantId: string

Private password

password: string

Private Optional timeout

timeout: string

Methods

Private _getCredentials

  • _getCredentials(): { merchantId: string; password: string }
  • Returns { merchantId: string; password: string }

    • merchantId: string
    • password: string

Private _post

  • _post(type: "token", payload: object): Promise<NABTransactTokenResponse>
  • _post(type: "periodic", payload: object): Promise<NABTransactPaymentResponse>
  • Parameters

    • type: "token"
    • payload: object

    Returns Promise<NABTransactTokenResponse>

  • Parameters

    • type: "periodic"
    • payload: object

    Returns Promise<NABTransactPaymentResponse>

addToken

  • addToken(messageId: string, tokenDetails: { cardNumber: string; expiryDate: string }): Promise<NABTransactTokenResponse>
  • summary

    Add a new token

    Parameters

    • messageId: string

      The messageId is a reference for the xml request. If you had a server internally you could store all your xml request and this would be a way to locate the request if a payment was to fail. A request will still be sent if they have the same messageId and will be treated as a new xml request.

    • tokenDetails: { cardNumber: string; expiryDate: string }

      Token details.

      • cardNumber: string

        Credit card number.

      • expiryDate: string

        Credit card expiry date.

    Returns Promise<NABTransactTokenResponse>

deleteToken

  • deleteToken(messageId: string, tokenValue: string): Promise<NABTransactTokenResponse>
  • Parameters

    • messageId: string

      The messageId is a reference for the xml request. If you had a server internally you could store all your xml request and this would be a way to locate the request if a payment was to fail. A request will still be sent if they have the same messageId and will be treated as a new xml request.

    • tokenValue: string

      The token value that represents a stored card within NAB

    Returns Promise<NABTransactTokenResponse>

lookupToken

  • lookupToken(messageId: string, tokenValue: string): Promise<NABTransactTokenResponse>
  • Parameters

    • messageId: string

      The messageId is a reference for the xml request. If you had a server internally you could store all your xml request and this would be a way to locate the request if a payment was to fail. A request will still be sent if they have the same messageId and will be treated as a new xml request.

    • tokenValue: string

      The token value that represents a stored card within NAB Transact.

    Returns Promise<NABTransactTokenResponse>

triggerPayment

  • triggerPayment(messageId: string, paymentDetails: { amount: string; crn: string; transactionReference: string }): Promise<{ Data: TriggerPaymentData; MerchantInfo: MerchantInfo; MessageInfo: MessageInfo; RequestType: "Periodic"; Status: Status; isApproved: boolean }>
  • Parameters

    • messageId: string

      The messageId is a reference for the xml request. If you had a server internally you could store all your xml request and this would be a way to locate the request if a payment was to fail. A request will still be sent if they have the same messageId and will be treated as a new xml request.

    • paymentDetails: { amount: string; crn: string; transactionReference: string }

      Payment Details

      • amount: string

        Transaction amount in cents.

      • crn: string

        Unique identifier of customer or token.

      • transactionReference: string

        The transaction identifier. This value will appear against all processed transactions. Typically an invoice number. E.g. "invoice12345".

    Returns Promise<{ Data: TriggerPaymentData; MerchantInfo: MerchantInfo; MessageInfo: MessageInfo; RequestType: "Periodic"; Status: Status; isApproved: boolean }>

Generated using TypeDoc