3using System.Collections.Generic;
4using System.Threading.Tasks;
97 public override async Task
Parse(XmlElement Xml)
99 await base.Parse(Xml);
129 base.OnChildNodesUpdated();
131 this.from = this.GetValueElement<From>();
132 this.amount = this.GetValueElement<Amount>();
133 this.currency = this.GetValueElement<Currency>();
134 this.reference = this.GetValueElement<Reference>();
135 this.contract = this.GetValueElement<Contract>();
136 this.serviceProvider = this.GetValueElement<ServiceProvider>();
137 this.serviceId = this.GetValueElement<ServiceId>();
138 this.parameters = this.GetChildElements<Parameter>();
147 string ContractId = (await this.contract.
Evaluate(Arguments))?.ToString();
149 ContractId != Arguments.
Token?.OwnershipContract)
151 throw new Exception(
"Sell eDaler contract reference must be either the creation contract, or the current ownership contract.");
159 throw new Exception(
"Trust Provider not permitted to sell eDaler.");
169 ??
throw new Exception(
"Unable to get contract: " + ContractId);
172 throw new Exception(
"Contract is not in a signed state.");
175 throw new Exception(
"Contract not legally binding.");
190 if (PaymentLegalId is
null || PaymentJid is
null)
191 throw new Exception(
To +
" is not a part of the contract.");
194 throw new Exception(
"Unable to sell eDaler: Service ID not defined.");
197 throw new Exception(
"Unable to sell eDaler: Service Provider not defined.");
200 ??
throw new Exception(
"Unable to sell eDaler: Service Provider " +
ServiceProvider +
" not found or installed.");
205 throw new Exception(
"Unable to sell eDaler: Service Provider does not support selling of eDaler.");
209 throw new Exception(
"Unable to sell eDaler: Currency not defined.");
212 throw new Exception(
"Unable to sell eDaler: Amount must be positive.");
216 throw new Exception(
"Unable to sell eDaler: Invalid seller JID.");
219 throw new Exception(
"Unable to sell eDaler: Seller does not have an account on the current broker.");
222 ??
throw new Exception(
"Unable to get seller legal identity.");
224 string Country = PaymentIdentity[
"COUNTRY"];
226 if (
string.IsNullOrEmpty(Country))
227 throw new Exception(
"Seller legal identity lacks country.");
230 ??
throw new Exception(
"Payment Service ID not found.");
233 throw new Exception(
"Unable to sell eDaler: Selected service provider cannot perform action.");
236 throw new Exception(
"Unable to sell eDaler: Selected service provider does not support currency.");
238 Dictionary<CaseInsensitiveString, object> ContractParameters =
new Dictionary<CaseInsensitiveString, object>();
239 Dictionary<CaseInsensitiveString, CaseInsensitiveString> SellerIdParameters =
new Dictionary<CaseInsensitiveString, CaseInsensitiveString>();
243 string Key = (await P.
Key.Evaluate(Arguments))?.ToString() ??
string.Empty;
244 object Value = await P.
Value.Evaluate(Arguments);
246 ContractParameters[Key] = Value;
249 foreach (
Property P
in PaymentIdentity.Properties)
253 XmppServerModule.EDaler, PaymentLegalId, ContractId, ContractParameters, SellerIdParameters,
257 throw new Exception(Result.
Error);
Result of request payment.
bool Ok
If payment was successful or not.
string Error
Error message, if payment was not successful.
Contains information about a service provider that users can use to sell eDaler.
Contains information about one XMPP address.
bool HasAccount
If the address has an account part.
CaseInsensitiveString Domain
Domain
CaseInsensitiveString Account
Account
bool IsServerDomain(CaseInsensitiveString Domain, bool IncludeAlternativeDomains)
Checks if a domain is the server domain, or optionally, an alternative domain.
Represents a case-insensitive string.
Static class that dynamically manages types and interfaces available in the runtime environment.
static Type GetType(string FullName)
Gets a type, given its full name.
static object Instantiate(Type Type, params object[] Arguments)
Returns an instance of the type Type . If one needs to be created, it is. If the constructor requires...
Class managing a script expression.
static decimal ToDecimal(object Object)
Converts an object to a double value.
Represents a digital signature on a contract.
Contains the definition of a contract
Abstract base class of signatures
CaseInsensitiveString Name
Property name
CaseInsensitiveString Value
Property value
Provisioning and registry service component.
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.
HeaderValue Value
Parameter value
Defines a payment reference.
Sells eDaler to an account.
SellEDaler()
Sells eDaler to an account.
override string LocalName
Local name
override void OnChildNodesUpdated()
Method called whenever ChildNodes is updated.
override async Task Parse(XmlElement Xml)
Parses the State-machine node.
override async Task Execute(EvaluationArguments Arguments)
Evaluates the action node
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Parameter[] Parameters
Parameters
Defines a service provider.
Defines to whom a payment (or message) is sent.
Contains information required for evaluating script in a state-machine.
StateMachine Machine
Reference to state-machine definition.
Token Token
Reference to related token.
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
Service Module hosting the XMPP broker and its components.
Interface for information about a service provider that users can use to sell eDaler.
Task< bool > CanSellEDaler(CaseInsensitiveString AccountName)
If the service provider can be used to process a request to sell eDaler of a certain amount,...
Interface for information about a service provider that users can use to sell eDaler.
Grade Supports(T Object)
If the interface understands objects such as Object .
Interface for State-Machine nodes
ContractState
Recognized contract states