Skip to main content

Source Docs for Java Library

Class: webdev.core.CanFail

  • java.lang.Object
    • webdev.core.CanFail
    • Field Summary

      Fields 
      Modifier and TypeField and Description
      private java.util.ArrayList<java.lang.String>_errors
      The list of errors
    • Constructor Summary

      Constructors 
      Constructor and Description
      CanFail() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.lang.StringErrors()
      Get the errors sent by Paynow
      java.lang.StringErrors(char separator)
      Get the errors sent by payment
      voidFail(java.lang.String error)
      Throws an exception for critical errors and stores other non-critical errors
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _errors

        private final java.util.ArrayList<java.lang.String> _errors
        The list of errors
    • Constructor Detail

      • CanFail

        public CanFail()
    • Method Detail

      • Fail

        public final void Fail(java.lang.String error)
        Throws an exception for critical errors and stores other non-critical errors
        Parameters:
        error -
        Throws:
        InvalidIntegrationException
      • Errors

        public final java.lang.String Errors()
        Get the errors sent by Paynow
        Returns:
      • Errors

        public final java.lang.String Errors(char separator)
        Get the errors sent by payment
        Parameters:
        separator -
        Returns:
        The errors from paynow

Class: webdev.core.Constants

  • java.lang.Object
    • webdev.core.Constants


  • public final class Constants
    extends java.lang.Object
    • Field Detail

      • UrlInitiateTransaction

        public static final java.lang.String UrlInitiateTransaction
        See Also:

        Constant Field Values

      • UrlInitiateMobileTransaction

        public static final java.lang.String UrlInitiateMobileTransaction
        See Also:

        Constant Field Values

      • MobileMoneyMethodEcocash

        public static final java.lang.String MobileMoneyMethodEcocash
        See Also:

        Constant Field Values

    • Constructor Detail

      • Constants

        public Constants()

Class: webdev.core.IResponse

  • All Known Implementing Classes:
    StatusResponse


    public interface IResponse
    Base interface for all response-type classes
    • Method Detail

      • Success

        boolean Success()

Class: webdev.core.InitResponse



  • public class InitResponse
    extends CanFail
    This class is a wrapper around the response sent from Paynow when initiating a transaction
    • Field Summary

      Fields 
      Modifier and TypeField and Description
      private java.util.Map<java.lang.String,java.lang.String>Data 
      private booleanHasRedirect 
      private booleanWasSuccessful 
    • Constructor Summary

      Constructors 
      Constructor and Description
      InitResponse(java.util.Map<java.lang.String,java.lang.String> response)
      InitResponse constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      protected java.util.Map<java.lang.String,java.lang.String>getData() 
      java.util.Map<java.lang.String,java.lang.String>GetData()
      Get the original data sent from Paynow
      protected booleangetHasRedirect() 
      protected booleangetWasSuccessful() 
      private voidLoad()
      Reads through the response data sent from Paynow
      java.lang.StringPollUrl()
      Returns the poll URL sent from Paynow
      java.lang.StringRedirectLink()
      Returns the url the user should be taken to so they can make a payment
      protected voidsetHasRedirect(boolean value) 
      protected voidsetWasSuccessful(boolean value) 
      booleanSuccess()
      Gets a boolean indicating whether a request succeeded or failed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • Data

        private java.util.Map<java.lang.String,java.lang.String> Data
      • WasSuccessful

        private boolean WasSuccessful
      • HasRedirect

        private boolean HasRedirect
    • Constructor Detail

      • InitResponse

        public InitResponse(java.util.Map<java.lang.String,java.lang.String> response)
        InitResponse constructor.
        Parameters:
        response - Response data sent from Paynow
        Throws:
        InvalidIntegrationException - If the error returned from paynow is
    • Method Detail

      • getData

        protected final java.util.Map<java.lang.String,java.lang.String> getData()
      • getWasSuccessful

        protected final boolean getWasSuccessful()
      • setWasSuccessful

        protected final void setWasSuccessful(boolean value)
      • getHasRedirect

        protected final boolean getHasRedirect()
      • setHasRedirect

        protected final void setHasRedirect(boolean value)
      • Load

        private void Load()
        Reads through the response data sent from Paynow
      • PollUrl

        public final java.lang.String PollUrl()
        Returns the poll URL sent from Paynow
        Returns:
      • Success

        public final boolean Success()
        Gets a boolean indicating whether a request succeeded or failed
        Returns:
      • RedirectLink

        public final java.lang.String RedirectLink()
        Returns the url the user should be taken to so they can make a payment
        Returns:
      • GetData

        public final java.util.Map<java.lang.String,java.lang.String> GetData()
        Get the original data sent from Paynow
        Returns:

Class: webdev.core.StatusResponse

  • All Implemented Interfaces:
    IResponse


    public class StatusResponse
    extends CanFail
    implements IResponse
    This class is a wrapper around the status updates sent from Paynow
    • Field Summary

      Fields 
      Modifier and TypeField and Description
      private java.math.BigDecimalAmount
      The total amount of the transaction
      private java.util.Map<java.lang.String,java.lang.String>Data
      The data returned from Paynow
      private java.lang.StringReference
      The unique reference of the transaction
      private booleanWasPaid
      Boolean value indicatiing whether a transaction was paid or not
      private booleanWasSuccessful
      Boolean indicating whether a transaction was successful or not
    • Constructor Summary

      Constructors 
      Constructor and Description
      StatusResponse(java.util.Map<java.lang.String,java.lang.String> response)
      InitResponse constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.math.BigDecimalgetAmount() 
      protected java.util.Map<java.lang.String,java.lang.String>getData() 
      java.util.Map<java.lang.String,java.lang.String>GetData()
      Get the original data sent from Paynow
      java.lang.StringgetReference() 
      booleangetWasPaid() 
      protected booleangetWasSuccessful() 
      private voidLoad()
      Reads through the response data sent from Paynow
      booleanPaid() 
      java.lang.StringPollUrl()
      Returns the poll URL sent from Paynow
      voidsetAmount(java.math.BigDecimal value) 
      voidsetReference(java.lang.String value) 
      voidsetWasPaid(boolean value) 
      protected voidsetWasSuccessful(boolean value) 
      booleanSuccess()
      Gets a boolean indicating whether a request succeeded or failed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • Data

        private java.util.Map<java.lang.String,java.lang.String> Data
        The data returned from Paynow
      • WasSuccessful

        private boolean WasSuccessful
        Boolean indicating whether a transaction was successful or not
      • Reference

        private java.lang.String Reference
        The unique reference of the transaction
      • Amount

        private java.math.BigDecimal Amount
        The total amount of the transaction
      • WasPaid

        private boolean WasPaid
        Boolean value indicatiing whether a transaction was paid or not
    • Constructor Detail

      • StatusResponse

        public StatusResponse(java.util.Map<java.lang.String,java.lang.String> response)
        InitResponse constructor.
        Parameters:
        response - Response data sent from Paynow
        Throws:
        InvalidIntegrationException - If the error returned from paynow is
    • Method Detail

      • getData

        protected final java.util.Map<java.lang.String,java.lang.String> getData()
      • getWasSuccessful

        protected final boolean getWasSuccessful()
      • setWasSuccessful

        protected final void setWasSuccessful(boolean value)
      • getReference

        public final java.lang.String getReference()
      • setReference

        public final void setReference(java.lang.String value)
      • getAmount

        public final java.math.BigDecimal getAmount()
      • setAmount

        public final void setAmount(java.math.BigDecimal value)
      • getWasPaid

        public final boolean getWasPaid()
      • setWasPaid

        public final void setWasPaid(boolean value)
      • Success

        public final boolean Success()
        Gets a boolean indicating whether a request succeeded or failed
        Specified by:
        Success in interface IResponse
        Returns:
        Boolean value indicating whether a request succeeded
      • Load

        private void Load()
        Reads through the response data sent from Paynow
      • PollUrl

        public final java.lang.String PollUrl()
        Returns the poll URL sent from Paynow
        Returns:
        The poll URL sent from Paynow
      • Paid

        public final boolean Paid()
      • GetData

        public final java.util.Map<java.lang.String,java.lang.String> GetData()
        Get the original data sent from Paynow
        Returns:
        The original data sent from Paynow

Class: webdev.exceptions.EmptyCartException

  • java.lang.Object
    • java.lang.Throwable
      • java.lang.Exception
        • java.lang.RuntimeException
          • webdev.exceptions.EmptyCartException
  • All Implemented Interfaces:
    java.io.Serializable


    public class EmptyCartException
    extends java.lang.RuntimeException
    Exception is thrown when user attempts sending an empty transaction to Paynow
    See Also:
    Serialized Form
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • EmptyCartException

        public EmptyCartException()

Class: webdev.exceptions.HashMismatchException

  • java.lang.Object
    • java.lang.Throwable
      • java.lang.Exception
        • java.lang.RuntimeException
          • webdev.exceptions.HashMismatchException
  • All Implemented Interfaces:
    java.io.Serializable


    public class HashMismatchException
    extends java.lang.RuntimeException
    Exception is thrown when the hash sent by Paynow is not equal to the hash generated locally
    See Also:
    Serialized Form
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HashMismatchException

        public HashMismatchException()

Class: webdev.exceptions.InvalidIntegrationException

  • java.lang.Object
    • java.lang.Throwable
      • java.lang.Exception
        • java.lang.RuntimeException
          • webdev.exceptions.InvalidIntegrationException
  • All Implemented Interfaces:
    java.io.Serializable


    public class InvalidIntegrationException
    extends java.lang.RuntimeException
    Exception is thrown when user attempts using invalid integration details
    See Also:
    Serialized Form
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • InvalidIntegrationException

        public InvalidIntegrationException()

Class: webdev.exceptions.InvalidReferenceException

  • java.lang.Object
    • java.lang.Throwable
      • java.lang.Exception
        • java.lang.RuntimeException
          • webdev.exceptions.InvalidReferenceException
  • All Implemented Interfaces:
    java.io.Serializable


    public class InvalidReferenceException
    extends java.lang.RuntimeException
    Exception is thrown when user attempts sending an empty transaction reference to Paynow
    See Also:
    Serialized Form
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • InvalidReferenceException

        public InvalidReferenceException()

Class: webdev.helpers.Extensions

  • java.lang.Object
    • webdev.helpers.Extensions


  • public final class Extensions
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      Extensions() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static java.math.BigDecimalAddCollectionValues(java.util.HashMap<java.lang.String,java.math.BigDecimal> items) 
      static java.lang.StringFlattenCollection(java.util.HashMap<java.lang.String,java.math.BigDecimal> items) 
      static java.lang.StringGetString(MobileMoneyMethod method) 
      static java.util.HashMap<java.lang.String,java.lang.String>ParseQueryString(java.lang.String qs) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Extensions

        public Extensions()
    • Method Detail

      • FlattenCollection

        public static java.lang.String FlattenCollection(java.util.HashMap<java.lang.String,java.math.BigDecimal> items)
      • AddCollectionValues

        public static java.math.BigDecimal AddCollectionValues(java.util.HashMap<java.lang.String,java.math.BigDecimal> items)
      • ParseQueryString

        public static java.util.HashMap<java.lang.String,java.lang.String> ParseQueryString(java.lang.String qs)

Class: webdev.helpers.Hash

  • java.lang.Object
    • webdev.helpers.Hash


  • public final class Hash
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      Hash() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static java.lang.StringGenerateHash(java.lang.String text) 
      private static byte[]GenerateSalt() 
      private static java.lang.StringGetStringFromHash(byte[] hash) 
      static java.lang.StringMake(java.util.Map<java.lang.String,java.lang.String> values, java.lang.String integrationKey)
      Hash the values in the given map
      static booleanVerify(java.util.Map<java.lang.String,java.lang.String> data, java.lang.String integrationKey)
      Verifies the given hash
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Hash

        public Hash()
    • Method Detail

      • Make

        public static java.lang.String Make(java.util.Map<java.lang.String,java.lang.String> values,
        java.lang.String integrationKey)
        Hash the values in the given map
        Parameters:
        values - Values to value
        integrationKey - Paynow integration key
        Returns:
      • GetStringFromHash

        private static java.lang.String GetStringFromHash(byte[] hash)
      • GenerateSalt

        private static byte[] GenerateSalt()
      • GenerateHash

        public static java.lang.String GenerateHash(java.lang.String text)
      • Verify

        public static boolean Verify(java.util.Map<java.lang.String,java.lang.String> data,
        java.lang.String integrationKey)
        Verifies the given hash

Class: webdev.http.Client

  • java.lang.Object
    • webdev.http.Client


  • public class Client
    extends java.lang.Object
    Http client
    • Constructor Summary

      Constructors 
      Constructor and Description
      Client() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.lang.StringPostAsync(java.lang.String url) 
      java.lang.StringPostAsync(java.lang.String url, java.util.HashMap<java.lang.String,java.lang.String> data) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Client

        public Client()
    • Method Detail

      • PostAsync

        public final java.lang.String PostAsync(java.lang.String url)
      • PostAsync

        public final java.lang.String PostAsync(java.lang.String url,
        java.util.HashMap<java.lang.String,java.lang.String> data)

Class: webdev.payments.MobileMoneyMethod

    • Enum Constant Summary

      Enum Constants 
      Enum Constant and Description
      Ecocash 
    • Field Summary

      Fields 
      Modifier and TypeField and Description
      static intSIZE 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static MobileMoneyMethodforValue(int value) 
      intgetValue() 
      static MobileMoneyMethodvalueOf(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MobileMoneyMethod[]values()

      Returns an array containing the constants of this enum type, in the order they are declared.

      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static MobileMoneyMethod[] values()

        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

        for (MobileMoneyMethod c : MobileMoneyMethod.values())   System.out.println(c);

        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MobileMoneyMethod valueOf(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:

        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

        java.lang.NullPointerException - if the argument is null
      • getValue

        public int getValue()