Show / Hide Table of Contents
    • Yort.LatitudePay.InStore
      • ILatitudePayClient
      • ILatitudePaySignatureGenerator
      • ILatitudePaySystemClock
      • LatitiudePayShippingLine
      • LatitudePayAddress
      • LatitudePayApiException
      • LatitudePayAuthToken
      • LatitudePayAvailability
      • LatitudePayCancelPurchaseRequest
      • LatitudePayCancelPurchaseResponse
      • LatitudePayClient
      • LatitudePayClientConfiguration
      • LatitudePayConfigurationRequest
      • LatitudePayConfigurationResponse
      • LatitudePayConstants
      • LatitudePayCreatePosPurchaseRequest
      • LatitudePayCreatePosPurchaseResponse
      • LatitudePayCreateRefundRequest
      • LatitudePayCreateRefundResponse
      • LatitudePayCurrencies
      • LatitudePayCustomer
      • LatitudePayEnvironment
      • LatitudePayHMACSHA256SignatureGenerator
      • LatitudePayMoney
      • LatitudePayProduct
      • LatitudePayPurchaseStatusRequest
      • LatitudePayPurchaseStatusResponse
      • LatitudePayReturnUrls
      • LatitudePaySystemClock

    Struct LatitudePayMoney

    Represents a monetary or financial value in the LatitudePay API as a tuple containing a numeric value and a string representing the associated currency.

    Implements
    IEquatable<LatitudePayMoney>
    Inherited Members
    Object.Equals(Object, Object)
    Object.GetType()
    Object.ReferenceEquals(Object, Object)
    Namespace: Yort.LatitudePay.InStore
    Assembly: Yort.LatitudePay.InStore.dll
    Syntax
    public struct LatitudePayMoney : IEquatable<LatitudePayMoney>
    Remarks

    This is an immutable value type. To set the value or currency you must use the LatitudePayMoney(Decimal, String) constructor.

    Instances created using the default construtor will return a zero value with the Currency property returning the value of NewZealandDollars.

    	//Assuming you have an variable called payment with a 'value' property containing the decimal amount 
    	//you want to send.
    	var amount = new LatitudePayMoney(Math.Round(payment.Value, 2));
    
    //This sample uses a literal value for illustration purposes
    var amount = new LatitudePayMoney(Math.Round(99.9900, 2));</code></pre>
    

    Constructors

    | Improve this Doc View Source

    LatitudePayMoney(Decimal)

    Constructs a new instance using the specified amount and currency.

    Declaration
    public LatitudePayMoney(decimal amount)
    Parameters
    Type Name Description
    Decimal amount

    A decimal value indicating the numeric value of this monetary value. This value should be rounded to the appropriate number of decimal places associated with the currency specified by Currency.

    Remarks

    This constructor uses the DefaultCurrency value for the Currency property of this instance. If DefaultCurrency is null or empty string then AustralianDollars will be used.

    | Improve this Doc View Source

    LatitudePayMoney(Decimal, String)

    Constructs a new instance using the specified amount and currency.

    Declaration
    public LatitudePayMoney(decimal amount, string currency)
    Parameters
    Type Name Description
    Decimal amount

    A decimal value indicating the numeric value of this monetary value. This value should be rounded to the appropriate number of decimal places associated with the currency specified by Currency.

    String currency

    A three chracter string that identifies the currency this monetary value is in.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if currency is null.

    ArgumentException

    Thrown if currency is an empty string or contains only whitespace, or has a length other than 3.

    Properties

    | Improve this Doc View Source

    Amount

    Returns the numeric amount of this monetary value in the currency specified by Currency.

    Declaration
    [JsonProperty("amount")]
    public decimal Amount { get; }
    Property Value
    Type Description
    Decimal
    Remarks

    This value should be rounded to the appropriate number of decimal places associated with the currency specified by Currency.

    See Also
    Currency
    | Improve this Doc View Source

    Currency

    Specifies the currency of the Amount/

    Declaration
    [Required]
    [JsonProperty("currency")]
    public string Currency { get; }
    Property Value
    Type Description
    String
    See Also
    Amount

    Methods

    | Improve this Doc View Source

    Equals(Object)

    Compares this instance to an object value and returns true if they are both LatitudePayMoney instances that are considered equal, otherwise false.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The other value to comnpare to.

    Returns
    Type Description
    Boolean

    True if obj is considered equal to this instance.

    Overrides
    ValueType.Equals(Object)
    Remarks

    If obj is null or not an instance of LatitudePayMoney then false is returned, otherwise the result of Equals(LatitudePayMoney) is returned.

    | Improve this Doc View Source

    Equals(LatitudePayMoney)

    Returns true if this instance is considered equal to other, otherwise returns false.

    Declaration
    public bool Equals(LatitudePayMoney other)
    Parameters
    Type Name Description
    LatitudePayMoney other

    The other instance to compare to.

    Returns
    Type Description
    Boolean

    True if the two instances are considered equal.

    Remarks

    Equality is determined by comparing the Amount properties for an exact match and the Currency properties for an ordinal, case-insensitive match.

    | Improve this Doc View Source

    GetHashCode()

    Returns the hashcode for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A integer that is the hashcode for this instance.

    Overrides
    ValueType.GetHashCode()
    | Improve this Doc View Source

    ToString()

    Returns the Amount property formatted as a currency using the current thread culture (which may or may not match the currency defined by Currency).

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string containing the formatted amount.

    Overrides
    ValueType.ToString()

    Operators

    | Improve this Doc View Source

    Equality(LatitudePayMoney, LatitudePayMoney)

    Performs equality checking on LatitudePayMoney instances.

    Declaration
    public static bool operator ==(LatitudePayMoney value1, LatitudePayMoney value2)
    Parameters
    Type Name Description
    LatitudePayMoney value1

    A LatitudePayMoney instance.

    LatitudePayMoney value2

    A LatitudePayMoney instance.

    Returns
    Type Description
    Boolean

    True if the instances are equal, otherwise false.

    Remarks

    Equality is determined by comparing the Amount properties for an exact match and the Currency properties for an ordinal, case-insensitive match.

    | Improve this Doc View Source

    Inequality(LatitudePayMoney, LatitudePayMoney)

    Performs inequality checking on LatitudePayMoney instances.

    Declaration
    public static bool operator !=(LatitudePayMoney value1, LatitudePayMoney value2)
    Parameters
    Type Name Description
    LatitudePayMoney value1

    A LatitudePayMoney instance.

    LatitudePayMoney value2

    A LatitudePayMoney instance.

    Returns
    Type Description
    Boolean

    True if the instances are not equal, otherwise false.

    Remarks

    Inverts the result of an == comparison.

    Implements

    System.IEquatable<T>

    See Also

    LatitudePayCurrencies
    • Improve this Doc
    • View Source
    Back to top Copyright (c) 2020 Troy Willmot