2using System.Collections.Generic;
4using System.Threading.Tasks;
57 private static readonly Dictionary<CaseInsensitiveString, AuctionItem> activeItems =
new Dictionary<CaseInsensitiveString, AuctionItem>();
58 private static decimal? minCommission =
null;
71 internal static async Task ContractSigned(
Contract Contract,
bool ContractIsLocked,
72 Dictionary<CaseInsensitiveString, Parameter> TransientParameters,
78 if ((TransientParameters?.Count ?? 0) > 0)
81 "Transient parameters not permitted in auctions.",
true, Legal,
EDaler);
85 switch (
Contract.ForMachinesLocalName)
91 XmlDocument Doc =
new XmlDocument()
93 PreserveWhitespace =
true
96 await AddItemForSale(Doc.DocumentElement,
Contract, ContractIsLocked, PaymentLegalId, PaymentJid, Legal,
EDaler, PubSub);
103 Doc =
new XmlDocument()
105 PreserveWhitespace =
true
108 await AddItemToBuy(Doc.DocumentElement,
Contract, ContractIsLocked, PaymentLegalId, PaymentJid, Legal,
EDaler, PubSub);
115 Doc =
new XmlDocument()
117 PreserveWhitespace =
true
120 await AddOffer(Doc.DocumentElement,
Contract, ContractIsLocked, Legal,
EDaler, PubSub);
129 internal static bool OnlyMissingAuctioneer(
Contract Contract,
string PaymentPartyRole,
130 string TrustProviderRole, out
string PaymentLegalId, out
string PaymentJid)
132 PaymentLegalId =
null;
138 if ((
Contract.Roles?.Length ?? 0) < 2)
141 bool HasAuctioneer =
false;
142 bool HasPaymentParty =
false;
143 Dictionary<string, SignatureStat> Signatures =
new Dictionary<string, SignatureStat>();
155 HasAuctioneer =
true;
159 if (!(PaymentPartyRole is
null) &&
Role.
Name == PaymentPartyRole)
164 HasPaymentParty =
true;
167 Signatures[
Role.
Name] =
new SignatureStat()
176 if (!HasAuctioneer || (!HasPaymentParty && !(PaymentPartyRole is
null)))
181 if (Signatures.TryGetValue(
Signature.Role, out SignatureStat Stat))
186 if (!(PaymentPartyRole is
null) &&
Signature.Role == PaymentPartyRole)
193 foreach (SignatureStat Stat
in Signatures.Values)
195 if (Stat.Count < Stat.Min || Stat.Count > Stat.Max)
214 private class SignatureStat
221 private static async Task<bool> AddItemForSale(XmlElement ForSale,
Contract Contract,
bool ContractIsLocked,
string PaymentLegalId,
224 AuctionItem Item = await ParseAuctionItem(ForSale, PaymentLegalId, PaymentJid,
Contract);
233 private static async Task<bool> AddItemToBuy(XmlElement ToBuy,
Contract Contract,
bool ContractIsLocked,
string PaymentLegalId,
236 AuctionItem Item = await ParseAuctionItem(ToBuy, PaymentLegalId, PaymentJid,
Contract);
248 Item.Direction = Direction;
251 Item.ScheduledExpiry = AddItem(Item,
EDaler);
253 SignatureReference Ref = await SignContract(
Contract, ContractIsLocked, Legal, PubSub, Item.Node,
AuctioneerRole);
258 activeItems.Remove(Item.ContractId);
262 Item.ScheduledExpiry = DateTime.MinValue;
268 Item.TrustProviderJid = Ref.BareJid;
269 Item.TrustProviderLegalId = Ref.LegalId;
274 internal class SignatureReference
276 public string LegalId;
277 public string BareJid;
282 return SignContract(
Contract, ContractIsLocked, Legal,
null,
null,
Role);
293 StringBuilder sb =
new StringBuilder();
299 if (ContractIsLocked)
306 Contract.
Serialize(sb,
false,
false,
false,
false,
false,
false,
false,
null, Legal);
307 byte[] Data = Encoding.UTF8.GetBytes(sb.ToString());
312 if (!
string.IsNullOrEmpty(Node))
314 string ContractXml =
null;
319 Contract.
Serialize(sb,
true,
true,
false,
false,
false,
false,
false,
null, Legal);
320 ContractXml = sb.ToString();
322 XmlDocument Xml =
new XmlDocument()
324 PreserveWhitespace =
true
326 Xml.LoadXml(ContractXml);
332 catch (XmlException ex)
342 SignatureReference Result =
new SignatureReference();
344 if (!(
Contract.ClientSignatures is
null))
350 Result.LegalId = Signature2.
Role;
351 Result.BareJid = Signature2.
BareJid;
365 Contract.
Serialize(sb,
true,
true,
false,
false,
false,
false,
false,
null, Legal);
367 string ContractXml = sb.ToString();
368 XmlDocument Xml =
new XmlDocument()
370 PreserveWhitespace =
true
372 Xml.LoadXml(ContractXml);
379 if (!
string.IsNullOrEmpty(Node))
386 Contract2.
Serialize(sb,
true,
true,
false,
false,
false,
false,
false);
387 ContractXml = sb.ToString();
388 Xml =
new XmlDocument()
390 PreserveWhitespace =
true
392 Xml.LoadXml(ContractXml);
398 catch (XmlException ex)
408 SignatureReference Result =
new SignatureReference();
412 foreach (Networking.XMPP.Contracts.ClientSignature
Signature in
426 catch (XmlException ex)
441 if (Item.ContractId is
null)
442 return DateTime.MaxValue;
446 activeItems[Item.ContractId] = Item;
449 Item.ScheduledExpiry =
Scheduler.
Add(Item.Expires.ToLocalTime(), ItemExpires,
new ExpiryRecord()
455 return Item.ScheduledExpiry;
458 private class ExpiryRecord
460 public AuctionItem Item;
468 if (scheduler is
null)
475 Log.Terminating += Log_Terminating;
483 private static void Log_Terminating(
object Sender, EventArgs e)
488 Log.Terminating -= Log_Terminating;
497 private static async Task<AuctionItem> ParseAuctionItem(XmlElement Item,
string PaymentLegalId,
500 List<AuctionItemTag> Tags =
new List<AuctionItemTag>();
501 List<ExpectedTag> ExpectedTags =
null;
505 string Currency =
null;
506 string ScoreFunction =
null;
507 string TokenId =
null;
508 decimal? AskingPrice =
null;
509 decimal? RejectPrice =
null;
510 decimal? AcceptPrice =
null;
511 decimal? CommissionPercent =
null;
512 decimal? RejectScore =
null;
513 decimal? AcceptScore =
null;
514 decimal? AvailableDays =
null;
516 foreach (XmlNode N
in Item.ChildNodes)
524 foreach (XmlNode N2
in E.ChildNodes)
526 if (!(N2 is XmlElement E2))
529 switch (E2.LocalName)
562 AuctionItemTag Tag =
new AuctionItemTag()
570 if (Tag.Name ==
"TokenID")
571 TokenId = Tag.Value as string;
578 foreach (XmlNode N2
in E.ChildNodes)
580 if (!(N2 is XmlElement E2))
583 switch (E2.LocalName)
615 case "CommissionPercent":
622 CommissionPercent = d4;
639 foreach (XmlNode N2
in E.ChildNodes)
641 if (!(N2 is XmlElement E2))
644 switch (E2.LocalName)
647 if (ExpectedTags is
null)
648 ExpectedTags =
new List<ExpectedTag>();
650 string Name = E2.InnerText;
653 if (E2.HasAttribute(
"where"))
655 Where = E2.GetAttribute(
"where");
656 if (!IsValidExpression(Where, out _))
663 ExpectedTags.Add(
new ExpectedTag()
670 case "ScoreFunction":
671 ScoreFunction = E2.InnerText;
672 if (!IsValidExpression(ScoreFunction, out _))
702 case "AvailableDays":
714 if (Type is
null || Class is
null || Currency is
null || !AskingPrice.HasValue || !CommissionPercent.HasValue || !AvailableDays.HasValue)
720 if (CommissionPercent.Value < await GetMinCommission())
728 if (
string.IsNullOrEmpty(TokenId))
755 if (
Token.
Expires.ToUniversalTime() < DateTime.UtcNow.AddDays((
double)AvailableDays.Value))
761 AuctionItem Item2 = await
Database.FindFirstIgnoreRest<AuctionItem>(
new FilterAnd(
765 if (!(Item2 is
null))
772 DateTime
Created = DateTime.UtcNow;
774 return new AuctionItem()
777 InitiatorLegalId = PaymentLegalId,
778 InitiatorJid = PaymentJid,
780 Expires =
Created.AddDays((
double)AvailableDays.Value),
785 Tags = Tags.ToArray(),
786 ExpectedTags = ExpectedTags?.ToArray(),
787 AskingPrice = AskingPrice.
Value,
788 AcceptPrice = AcceptPrice.Value,
789 RejectPrice = RejectPrice.Value,
790 CommissionPercent = CommissionPercent.Value,
792 ScoreFunction = ScoreFunction,
793 AcceptScore = AcceptScore,
794 RejectScore = RejectScore,
798 internal static async Task<decimal> GetMinCommission()
800 if (!minCommission.HasValue)
803 return (decimal)minCommission.Value;
806 private static bool IsValidExpression(
string Script, out
ScriptNode Prohibited)
808 if (
string.IsNullOrEmpty(Script))
830 List<AuctionItemTag> Tags =
new List<AuctionItemTag>();
832 string Currency =
null;
833 decimal? Price =
null;
835 foreach (XmlNode N
in Offer.ChildNodes)
843 AuctionItemTag Tag =
new AuctionItemTag()
850 v[Tag.Name] = Tag.Value;
873 case "ItemReference":
880 int i = s2.IndexOf(
'@');
881 if (i < 0 || !Guid.TryParse(s2.Substring(0, i), out Guid _))
899 if (ItemReference is
null || Currency is
null || !Price.HasValue)
909 if (!activeItems.TryGetValue(ItemReference, out Item))
919 if (!(Item.Tags is
null))
921 foreach (AuctionItemTag Tag
in Item.Tags)
924 v[Tag.Name] = Tag.Value;
928 v[
"Price"] = Price.Value;
930 if (!(Item.ExpectedTags is
null))
932 foreach (ExpectedTag ExpectedTag
in Item.ExpectedTags)
936 Log.
Error(
"Rejected marketplace offer: Tag '" + ExpectedTag
941 if (!
string.IsNullOrEmpty(ExpectedTag.Where))
945 object Result = await ExpectedTag.Parsed.EvaluateAsync(v);
947 if (Result is
bool b)
951 Log.
Error(
"Rejected marketplace offer: Tag '" + ExpectedTag
952 +
"' not valid in accordance with where expression.", ItemReference,
Contract.
ContractId);
958 Log.
Error(
"Rejected marketplace offer: Where expression for '" + ExpectedTag
965 Log.
Error(
"Rejected marketplace offer: Where expression for '" + ExpectedTag
974 bool NewBest =
false;
975 decimal? Score =
null;
976 string BestBidContractIdBak = Item.BestBidContractId;
977 string BestBidLegalIdBak = Item.BestBidLegalId;
978 string BestBidLegalJidBak = Item.BestBidJid;
979 decimal? BestBidPriceBak = Item.BestBidPrice;
980 decimal? BestBidScoreBak = Item.BestBidScore;
981 string PaymentLegalId;
984 switch (Item.Direction)
1008 if (Item.Processed.HasValue)
1014 if (Currency != Item.Currency)
1020 if (Item.RejectPrice.HasValue)
1022 switch (Item.Direction)
1025 if (Price.Value < Item.RejectPrice.Value)
1033 if (Price.Value > Item.RejectPrice.Value)
1042 if (!(Item.ScoreFunction is
null))
1046 if (Item.ScoreExpression is
null)
1051 throw new UnauthorizedAccessException(
"Expression not permitted: " + Prohibited?.SubExpression);
1053 Item.ScoreExpression = Exp;
1056 object Result = await Item.ScoreExpression.
EvaluateAsync(v);
1059 catch (Exception ex)
1065 if (Item.RejectScore.HasValue)
1067 switch (Item.Direction)
1070 if (Score.Value < Item.RejectScore.Value)
1078 if (Score.Value > Item.RejectScore.Value)
1087 if (Item.AcceptScore.HasValue)
1089 switch (Item.Direction)
1092 if (Score.Value >= Item.AcceptScore.Value)
1094 Accept = NewBest =
true;
1095 Item.Processed = DateTime.UtcNow;
1100 if (Score.Value <= Item.AcceptScore.Value)
1102 Accept = NewBest =
true;
1103 Item.Processed = DateTime.UtcNow;
1110 if (Item.AcceptPrice.HasValue && !Accept)
1112 switch (Item.Direction)
1115 if (Price.Value >= Item.AcceptPrice.Value)
1117 Accept = NewBest =
true;
1118 Item.Processed = DateTime.UtcNow;
1123 if (Price.Value <= Item.AcceptPrice.Value)
1125 Accept = NewBest =
true;
1126 Item.Processed = DateTime.UtcNow;
1136 switch (Item.Direction)
1139 if (!Item.BestBidScore.HasValue || Score.Value > Item.BestBidScore.Value)
1144 if (!Item.BestBidScore.HasValue || Score.Value < Item.BestBidScore.Value)
1151 switch (Item.Direction)
1154 if (!Item.BestBidPrice.HasValue || Price.Value > Item.BestBidPrice.Value)
1159 if (!Item.BestBidPrice.HasValue || Price.Value < Item.BestBidPrice.Value)
1169 Item.BestBidLegalId = PaymentLegalId;
1170 Item.BestBidJid = PaymentJid;
1171 Item.BestBidPrice = Price;
1172 Item.BestBidScore = Score;
1179 Item.Processed =
null;
1183 Item.BestBidContractId = BestBidContractIdBak;
1184 Item.BestBidLegalId = BestBidLegalIdBak;
1185 Item.BestBidJid = BestBidLegalJidBak;
1186 Item.BestBidPrice = BestBidPriceBak;
1187 Item.BestBidScore = BestBidScoreBak;
1193 if (!Accept && NewBest)
1199 ContractId = ItemReference,
1200 OfferLegalId = PaymentLegalId,
1201 OfferJid = PaymentJid,
1203 Price = Price.
Value,
1204 Currency = Currency,
1205 Score = Score ?? Price,
1206 Tags = Tags.ToArray()
1211 if (await ResolvePayments(Item,
EDaler,
false))
1215 activeItems.Remove(Item.ContractId);
1219 Item.ScheduledExpiry = DateTime.MinValue;
1223 Item.Processed =
null;
1224 Item.BestBidContractId = BestBidContractIdBak;
1225 Item.BestBidLegalId = BestBidLegalIdBak;
1226 Item.BestBidJid = BestBidLegalJidBak;
1227 Item.BestBidPrice = BestBidPriceBak;
1228 Item.BestBidScore = BestBidScoreBak;
1237 private static async Task ItemExpires(
object P)
1239 ExpiryRecord Rec = (ExpiryRecord)P;
1240 AuctionItem Item = Rec.Item;
1241 if (Item.Processed.HasValue)
1246 activeItems.Remove(Item.ContractId);
1249 Item.Processed = DateTime.UtcNow;
1251 if (!await ResolvePayments(Item, Rec.EDaler,
true))
1252 Log.
Error(
"Auctioned item expired, but payments offered were not possible to process.", Item.ContractId);
1256 bool BackTrackIfPaymentFails)
1260 if (Item.BestBidPrice.HasValue)
1265 decimal Amount = Item.BestBidPrice.
Value;
1267 if (!(Ok = await ResolvePayments(BidderId, BidderJid, Amount, BidId, Item,
EDaler)))
1269 if (BackTrackIfPaymentFails)
1271 string Order = Item.Direction == OptimizeDirection.Up ?
"-Score" :
"Score";
1272 IEnumerable<AuctionOffer> Bids = await
Database.
Find<AuctionOffer>(
1278 foreach (AuctionOffer Bid
in Bids)
1280 BidderId = Bid.OfferLegalId;
1281 BidderJid = Bid.OfferJid;
1282 BidId = Bid.OfferContractId;
1285 if (Ok = await ResolvePayments(BidderId, BidderJid, Amount, BidId, Item,
EDaler))
1301 decimal Commission = Amount * Item.CommissionPercent * 0.01m;
1302 string Ref =
"iotsc:" + Item.ContractId;
1304 int i = Item.ContractId.IndexOf(
'@');
1306 if (i <= 0 || !Guid.TryParse(Item.ContractId.Substring(0, i), out Guid TransactionId))
1307 TransactionId = Guid.NewGuid();
1311 string TokenId = Item.
TokenId;
1312 if (
string.IsNullOrEmpty(TokenId))
1324 switch (Item.Direction)
1331 Item.SalePaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(TransactionId, Bidder,
true,
1333 BidId,
null, 1, out _, out _);
1335 Item.CommissionPaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(Guid.NewGuid(),
1337 Amount - Commission,
null, Ref, Item.ContractId,
null, 1, out _, out _);
1346 Item.SalePaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(TransactionId, Item.InitiatorLegalId,
true,
1348 null, Ref, Item.ContractId,
null, 1, out _, out _);
1350 Item.CommissionPaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(Guid.NewGuid(),
1352 Ref, Item.ContractId,
null, 1, out _, out _);
1362 Log.
Error(
"Unable to process payment for consigned auction item.",
1363 Item.ContractId,
string.Empty,
"AuctionPayment",
1364 new KeyValuePair<string, object>(
"Bidder", Bidder),
1365 new KeyValuePair<string, object>(
"BidId", BidId),
1366 new KeyValuePair<string, object>(
"Amount", Amount),
1367 new KeyValuePair<string, object>(
"Currency", Item.Currency));
1375 if (!
string.IsNullOrEmpty(Msg))
1377 Log.
Error(
"Auction payment error: Sales payment went through to Auctioneer, but secondary payment failed: " + Msg,
1378 Item.ContractId,
string.Empty,
"AuctionPayment",
1379 new KeyValuePair<string, object>(
"Bidder", Bidder),
1380 new KeyValuePair<string, object>(
"BidId", BidId),
1381 new KeyValuePair<string, object>(
"Amount", Amount),
1382 new KeyValuePair<string, object>(
"Currency", Item.Currency),
1383 new KeyValuePair<string, object>(
"URI", Item.CommissionPaymentUri));
1387 if (!(
Token is
null))
1394 switch (Item.Direction)
1398 SellerJid = Item.InitiatorJid;
1399 BuyerJid = BidderJid;
1401 Token.Value = Amount;
1402 Token.Currency = Item.Currency;
1403 Token.Owner = Bidder;
1404 Token.OwnerJid = BidderJid;
1405 Token.OwnershipContract = BidId;
1413 Seller = Item.InitiatorLegalId,
1414 Owner = Item.TrustProviderLegalId,
1415 OwnershipContract = Item.ContractId,
1418 Currency = Item.Currency,
1420 Timestamp = DateTime.UtcNow.AddSeconds(-1),
1429 Seller = Item.TrustProviderLegalId,
1431 OwnershipContract = BidId,
1433 Commission = Commission,
1434 Currency = Item.Currency,
1436 Timestamp = DateTime.UtcNow,
1443 SellerJid = BidderJid;
1444 BuyerJid = Item.InitiatorJid;
1446 Token.Value = Amount;
1447 Token.Currency = Item.Currency;
1448 Token.Owner = Item.InitiatorLegalId;
1449 Token.OwnerJid = Item.InitiatorJid;
1450 Token.OwnershipContract = Item.ContractId;
1459 Owner = Item.TrustProviderLegalId,
1460 OwnershipContract = BidId,
1463 Currency = Item.Currency,
1465 Timestamp = DateTime.UtcNow.AddSeconds(-1),
1474 Seller = Item.TrustProviderLegalId,
1475 Owner = Item.InitiatorLegalId,
1476 OwnershipContract = Item.ContractId,
1478 Commission = Commission,
1479 Currency = Item.Currency,
1481 Timestamp = DateTime.UtcNow,
1501 catch (Exception ex)
1517 catch (Exception ex)
1526 catch (Exception ex)
1531 StringBuilder Xml =
new StringBuilder();
1533 Xml.Append(
"<tokenRemoved xmlns='");
1537 Xml.Append(
"</tokenRemoved>");
1544 Xml.Append(
"<tokenAdded xmlns='");
1548 Xml.Append(
"</tokenAdded>");
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
static XmlException AnnotateException(XmlException ex)
Creates a new XML Exception object, with reference to the source XML file, for information.
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an error event.
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Static class managing the runtime environment of the IoT Gateway.
static ContractsClient ContractsClient
XMPP Contracts Client, if such a compoent is available on the XMPP broker.
Configures legal identity for the gateway.
static bool IsMeApproved(CaseInsensitiveString LegalId)
Checks if a Legal Identity refers to an approved ID of the gateway.
Contains the definition of a contract
static Task< ParsedContract > Parse(XmlDocument Xml)
Validates a contract XML Document, and returns the contract definition in it.
ClientSignature[] ClientSignatures
Client signatures of the contract.
void Serialize(StringBuilder Xml, bool IncludeNamespace, bool IncludeIdAttribute, bool IncludeClientSignatures, bool IncludeAttachments, bool IncludeStatus, bool IncludeServerSignature, bool IncludeAttachmentReferences)
Serializes the Contract, in normalized form.
string DefaultLanguage
Default language for contract.
Contains information about a parsed contract.
Contract Contract
Contract object
CaseInsensitiveString Subdomain
Subdomain name.
XmppAddress MainDomain
Main/principal domain address
bool IsComponentDomain(CaseInsensitiveString Domain, bool IncludeAlternativeDomains)
Checks if a domain is the component domain, or optionally, an alternative component domain.
Contains information about one XMPP address.
CaseInsensitiveString Address
XMPP Address
static bool CheckExpressionSafe(Expression Expression, out ScriptNode Prohibited)
Checks if an expression is safe to execute (if it comes from an external source).
Represents a case-insensitive string.
string Value
String-representation of the case-insensitive string. (Representation is case sensitive....
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
string LowerCase
Lower-case representation of the case-insensitive string.
CaseInsensitiveString Substring(int startIndex, int length)
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
static Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
static async Task Update(object Object)
Updates an object in the database.
static async Task Delete(object Object)
Deletes an object in the database.
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field equal to a given value.
This filter selects objects that have a named field not equal to a given value.
Static class that dynamically manages types and interfaces available in the runtime environment.
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Static class managing persistent settings.
static async Task< string > GetAsync(string Key, string DefaultValue)
Gets a string-valued setting.
Represents a named semaphore, i.e. an object, identified by a name, that allows single concurrent wri...
async void Dispose()
Disposes of the named semaphore, and releases any locks the object manages.
Static class of application-wide semaphores that can be used to order access to editable objects.
static async Task< Semaphore > BeginWrite(string Key)
Waits until the semaphore identified by Key is ready for writing. Each call to BeginWrite must be fo...
Class that can be used to schedule events in time. It uses a timer to execute tasks at the appointed ...
bool Remove(DateTime When)
Removes an event scheduled for a given point in time.
void Dispose()
IDisposable.Dispose
DateTime Add(DateTime When, ScheduledEventCallback Callback, object State)
Adds an event.
Class managing a script expression.
async Task< object > EvaluateAsync(Variables Variables)
Evaluates the expression, using the variables provided in the Variables collection....
static decimal ToDecimal(object Object)
Converts an object to a double value.
Base class for all nodes in a parsed script tree.
virtual bool ContainsVariable(string Name)
If the collection contains a variable with a given name.
Manages eDaler on accounts connected to the broker.
Represents a digital signature on a contract.
CaseInsensitiveString BareJid
Bare JID of the client used to generate the signature.
CaseInsensitiveString Role
Role of the legal identity in the contract.
Contains the definition of a contract
void Serialize(StringBuilder Xml, bool IncludeNamespace, bool IncludeIdAttribute, bool IncludeClientSignatures, bool IncludeAttachments, bool IncludeStatus, bool IncludeServerSignature, bool IncludeAttachmentReferences, Dictionary< string, string > AttachmentsUrls, LegalComponent LegalComponent)
Serializes the Contract, in normalized form.
string DefaultLanguage
Default language for contract.
CaseInsensitiveString ContractId
Contract Identity
Class defining a part in a contract
CaseInsensitiveString Role
Role of the part in the contract
CaseInsensitiveString LegalId
Legal identity of part
int MinCount
Smallest amount of signatures of this role required for a legally binding contract.
bool CanRevoke
If parts having this role, can revoke their signature, once signed.
int MaxCount
Largest amount of signatures of this role required for a legally binding contract.
CaseInsensitiveString Name
Name of the role.
Abstract base class of signatures
Provisioning and registry service component.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
const string SellerRole
Role name of seller.
const string AuctioneerRole
Role name of auctioneer.
const string BuyerRole
Role name of buyer.
const string MarketplaceNamespace
https://paiwise.tagroot.io/Schema/Marketplace.xsd
Event raised when a token has been created.
decimal Value
Latest value of token
Event raised when a token has been transferred.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
const string NeuroFeaturesNamespace
https://paiwise.tagroot.io/Schema/NeuroFeatures.xsd
Duration? ArchiveOptional
Duration after which token expires, and the required archiving time, the token can optionally be arch...
void Serialize(StringBuilder Xml, bool IncludeNamespace, bool IncludeServerSignature)
Serializes the Token, in normalized form.
CaseInsensitiveString OwnerJid
JID of Current owner of token
Duration? ArchiveRequired
Duration after which token expires, the token is required to be archived.
DateTime Expires
Expiry date of token.
CaseInsensitiveString TokenId
Token ID
Paiwise processor, processing payment instructions defined in smart contracts.
PubSub component, as defined in XEP-0060. https://xmpp.org/extensions/xep-0060.html
Task< string > PublishItem(string Service, string NodeName, string AutoCreateAccess, string From, string Domain, string ItemId, string XmlContent, string Language)
Call this method for automated publishing of pubsub items from hosted services.
ContractState
Recognized contract states
OptimizeDirection
Direction in which to optimize prices and/or scores.
NodeAccessModel
Node access model.