2using System.Threading.Tasks;
85 public override async Task
Parse(XmlElement Xml)
87 this.TransactionVariable =
XML.
Attribute(Xml,
"transactionVariable");
89 await base.Parse(Xml);
117 base.OnChildNodesUpdated();
119 this.from = this.GetValueElement<From>();
120 this.amount = this.GetValueElement<Amount>();
121 this.currency = this.GetValueElement<Currency>();
122 this.validDays = this.GetValueElement<ValidDays>();
123 this.reference = this.GetValueElement<Reference>();
124 this.contract = this.GetValueElement<Contract>();
135 throw new Exception(
"ReserveAmounts must be valid a positive number of days.");
141 throw new Exception(
"ReserveAmount contract reference must be either the creation contract, or the current ownership contract.");
144 string From = (await this.from.
Evaluate(Arguments))?.ToString();
149 throw new Exception(
"State-Machine payments from trust provider not permitted.");
156 Guid TransactionId = Guid.NewGuid();
157 string ReserveAmountUri =
PaiwiseProcessor.GenerateReserveAmountUri(TransactionId,
161 if (!
string.IsNullOrEmpty(Msg))
162 throw new Exception(Msg);
165 Arguments.
Variables[
this.TransactionVariable] = TransactionId.ToString();
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Class managing a script expression.
static decimal ToDecimal(object Object)
Converts an object to a double value.
static double ToDouble(object Object)
Converts an object to a double value.
Paiwise processor, processing payment instructions defined in smart contracts.
Abstract base class for State-Machine action nodes.
Defines amount to be sent.
Defines a payment contract.
Defines currency to be sent.
Defines from whom a payment (or message) is sent.
Defines a payment action.
Defines a payment reference.
Reserves an amount of an account.
ReserveAmount()
Defines a payment action.
override void OnChildNodesUpdated()
Method called whenever ChildNodes is updated.
Contract Contract
Contract value
string TransactionVariable
Optional transaction variable name.
ValidDays ValidDays
ValidDays value
override async Task Parse(XmlElement Xml)
Parses the State-machine node.
override async Task Execute(EvaluationArguments Arguments)
Evaluates the action node
Reference Reference
Reference value
override string LocalName
Local name
Currency Currency
Currency value
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Amount Amount
Amount value
Defines number of days payment is valid, before it must be processed.
Contains information required for evaluating script in a state-machine.
StateMachine Machine
Reference to state-machine definition.
EDalerComponent EDaler
eDaler component.
Token Token
Reference to related token.
Variables Variables
Current set of variables.
void ConvertValueAttributesToElements(XmlElement Xml, Type[] ValueTypes, bool[] Required)
Converts value attributes to parsed elements. The XML definition has to be parsed before,...
Task< object > Evaluate(EvaluationArguments Arguments)
Evaluates the value node.
CaseInsensitiveString TrustProviderJid
JID of Trust Provider
CaseInsensitiveString DefinitionContractId
ID of Definition Contract
CaseInsensitiveString TrustProvider
ID of Trust Provider
Interface for State-Machine nodes