Struct AfterPayMoney
Represents a monetary or financial value in the AfterPay API as a tuple containing a numeric value and a string representing the associated currency.
Implements
Inherited Members
Namespace: Yort.AfterPay.InStore
Assembly: cs.temp.dll.dll
Syntax
public struct AfterPayMoney : IEquatable<AfterPayMoney>
Remarks
This is an immutable value type. To set the value or currency you must use the AfterPayMoney(Decimal, String) constructor.
Instances created using the default construtor will return a zero value with the Currency property returning the value of AustralianDollars.
Note it is important the Amount property be set with the correct number of decimals. Using too many decimal places (more than 2 for AUD or NZD) will result in a 400 - bad request, invalid json response from the server.
You can use the
//Assuming you have an variable called payment with a 'value' property containing the decimal amount
//you want to send to after pay.
var amount = new AfterPayMoney(Math.Round(payment.Value, 2));
//This sample uses a literal value for illustration purposes
var amount = new AfterPayMoney(Math.Round(99.9900, 2));
See https://docs.afterpay.com.au/instore-api-v1.html#money-object for more information.
Constructors
Name | Description |
---|---|
AfterPayMoney(Decimal) | Constructs a new instance using the specified amount and currency. |
AfterPayMoney(Decimal, String) | Constructs a new instance using the specified amount and currency. |
Properties
Name | Description |
---|---|
Amount | Returns the numeric amount of this monetary value in the currency specified by Currency. |
Currency | Specifies the currency of the Amount/ |
Methods
Name | Description |
---|---|
Equals(Object) | Compares this instance to an object value and returns true if they are both AfterPayMoney instances that are considered equal, otherwise false. |
Equals(AfterPayMoney) | Returns true if this instance is considered equal to |
GetHashCode() | Returns the hashcode for this instance. |
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). |
Operators
Name | Description |
---|---|
Equality(AfterPayMoney, AfterPayMoney) | Performs equality checking on AfterPayMoney instances. |
Inequality(AfterPayMoney, AfterPayMoney) | Performs inequality checking on AfterPayMoney instances. |