Source Docs for Java Library
Class: webdev.core.CanFail
- java.lang.Object
-
- webdev.core.CanFail
-
- Direct Known Subclasses:
- InitResponse, StatusResponse
public abstract class CanFail extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field and Description private java.util.ArrayList<java.lang.String>_errorsThe list of errors
-
Constructor Summary
Constructors Constructor and Description CanFail()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringErrors()Get the errors sent by Paynowjava.lang.StringErrors(char separator)Get the errors sent by paymentvoidFail(java.lang.String error)Throws an exception for critical errors and stores other non-critical errors
-
-
-
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 Summary
Fields Modifier and Type Field and Description static java.lang.StringMobileMoneyMethodEcocashstatic java.lang.StringResponseErrorstatic java.lang.StringResponseInvalidIdstatic java.lang.StringResponseOkstatic java.lang.StringResponsePaidstatic java.lang.StringUrlInitiateMobileTransactionstatic java.lang.StringUrlInitiateTransaction
-
Constructor Summary
Constructors Constructor and Description Constants()
-
-
-
Field Detail
-
ResponseOk
public static final java.lang.String ResponseOk
- See Also:
- Constant Field Values
-
ResponsePaid
public static final java.lang.String ResponsePaid
- See Also:
- Constant Field Values
-
ResponseError
public static final java.lang.String ResponseError
- See Also:
- Constant Field Values
-
ResponseInvalidId
public static final java.lang.String ResponseInvalidId
- See Also:
- Constant Field Values
-
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
-
-
Class: webdev.core.IResponse
-
- All Known Implementing Classes:
- StatusResponse
public interface IResponseBase interface for all response-type classes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description booleanSuccess()
-
Class: webdev.core.InitResponse
- java.lang.Object
-
- webdev.core.CanFail
-
- 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 Type Field and Description private java.util.Map<java.lang.String,java.lang.String>Dataprivate booleanHasRedirectprivate 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 Type Method 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 Paynowprotected booleangetHasRedirect()protected booleangetWasSuccessful()private voidLoad()Reads through the response data sent from Paynowjava.lang.StringPollUrl()Returns the poll URL sent from Paynowjava.lang.StringRedirectLink()Returns the url the user should be taken to so they can make a paymentprotected voidsetHasRedirect(boolean value)protected voidsetWasSuccessful(boolean value)booleanSuccess()Gets a boolean indicating whether a request succeeded or failed
-
-
-
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
- java.lang.Object
-
- webdev.core.CanFail
-
- webdev.core.StatusResponse
-
-
Field Summary
Fields Modifier and Type Field and Description private java.math.BigDecimalAmountThe total amount of the transactionprivate java.util.Map<java.lang.String,java.lang.String>DataThe data returned from Paynowprivate java.lang.StringReferenceThe unique reference of the transactionprivate booleanWasPaidBoolean value indicatiing whether a transaction was paid or notprivate booleanWasSuccessfulBoolean 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 Type Method 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 Paynowjava.lang.StringgetReference()booleangetWasPaid()protected booleangetWasSuccessful()private voidLoad()Reads through the response data sent from PaynowbooleanPaid()java.lang.StringPollUrl()Returns the poll URL sent from PaynowvoidsetAmount(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
-
-
-
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
-
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.RuntimeExceptionException is thrown when user attempts sending an empty transaction to Paynow- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description 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.RuntimeExceptionException is thrown when the hash sent by Paynow is not equal to the hash generated locally- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description 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.RuntimeExceptionException is thrown when user attempts using invalid integration details- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description 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.RuntimeExceptionException is thrown when user attempts sending an empty transaction reference to Paynow- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description 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 Type Method 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)
-
-
-
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)
-
GetString
public static java.lang.String GetString(MobileMoneyMethod method)
-
-
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 Type Method 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 mapstatic booleanVerify(java.util.Map<java.lang.String,java.lang.String> data, java.lang.String integrationKey)Verifies the given 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 valueintegrationKey- 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.ObjectHttp client
-
-
Constructor Summary
Constructors Constructor and Description Client()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
Class: webdev.payments.MobileMoneyMethod
- java.lang.Object
-
- java.lang.Enum<MobileMoneyMethod>
-
- webdev.payments.MobileMoneyMethod
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<MobileMoneyMethod>
public enum MobileMoneyMethod extends java.lang.Enum<MobileMoneyMethod>
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description Ecocash
-
Field Summary
Fields Modifier and Type Field and Description static intSIZE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Enum Constant Detail
-
Ecocash
public static final MobileMoneyMethod Ecocash
-
-
Field Detail
-
SIZE
public static final int SIZE
- See Also:
- Constant Field Values
-
-
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 namejava.lang.NullPointerException- if the argument is null
-
getValue
public int getValue()
-
forValue
public static MobileMoneyMethod forValue(int value)
-
-
